Skip to content

Commit 4fa69c1

Browse files
authored
Merge pull request #26 from mitre-attack/beta
Generate declaration files
2 parents 8782546 + 28eae14 commit 4fa69c1

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,20 @@ jobs:
4040
- name: Install dependencies
4141
run: npm ci
4242

43-
- name: Validate all commits
44-
run: npx commitlint --from ${{ github.event.pull_request.base.sha || github.event.before }} --to ${{ github.event.pull_request.head.sha || github.sha }} --verbose
43+
- name: Determine commit range
44+
id: commit_range
45+
run: |
46+
if [ "${{ github.event_name }}" = "pull_request" ]; then
47+
echo "base_sha=$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }})" >> $GITHUB_OUTPUT
48+
echo "head_sha=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
49+
else
50+
# For push events or when PR base isn't available
51+
echo "base_sha=$(git rev-parse HEAD~1)" >> $GITHUB_OUTPUT
52+
echo "head_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
53+
fi
54+
55+
- name: Validate commits
56+
run: npx commitlint --from ${{ steps.commit_range.outputs.base_sha }} --to ${{ steps.commit_range.outputs.head_sha }} --verbose
4557

4658
# Job 2: Build and Test
4759
test:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"email": "[email protected]"
3131
},
3232
"scripts": {
33-
"build": "npx tsup --format esm,cjs src",
33+
"build": "npx tsup --dts --format esm,cjs src",
3434
"prepublishOnly": "rm -rf dist && npm run build",
3535
"test": "vitest --run",
3636
"test:interactive": "vitest",

src/classes/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Relationship } from '../schemas/sro/relationship.schema.js';
22
import type { AttackObject } from '../schemas/sdo/stix-bundle.schema.js';
3-
import type { Technique, Tactic } from '../schemas/sdo/index.js';
3+
import type { Technique, Tactic, Mitigation, DataSource } from '../schemas/sdo/index.js';
44
import { TacticImpl } from './sdo/tactic.impl.js';
55
import { MitigationImpl } from './sdo/mitigation.impl.js';
66
import { DataSourceImpl } from './sdo/data-source.impl.js';
@@ -45,7 +45,7 @@ export function getMitigations(
4545
.map((rel) => {
4646
const mitigation = attackObjects.find((obj) => obj.id === rel.source_ref);
4747
if (mitigation && mitigation.type === 'course-of-action') {
48-
return new MitigationImpl(mitigation);
48+
return new MitigationImpl(mitigation as Mitigation);
4949
}
5050
return null;
5151
})
@@ -62,7 +62,7 @@ export function getDataSources(
6262
.map((rel) => {
6363
const dataSource = attackObjects.find((obj) => obj.id === rel.source_ref);
6464
if (dataSource && dataSource.type === 'x-mitre-data-source') {
65-
return new DataSourceImpl(dataSource);
65+
return new DataSourceImpl(dataSource as DataSource);
6666
}
6767
return null;
6868
})

0 commit comments

Comments
 (0)