Skip to content

Commit 382fced

Browse files
authored
Code Scanning Alert Documentation and fixes (#29)
1 parent 50f6253 commit 382fced

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,22 @@ This action will download an Augmented SBOM file in `$RELEASE_ASSETS/sbom.json`.
132132
silk_asset_group: mongodb-python-driver
133133
```
134134

135+
### Code Scanning Alerts
136+
137+
This action will export all dismissed and open alerts to a SARIF file. By
138+
default, this file is named `code-scanning-alerts.json` and placed in the
139+
working directory.
140+
141+
```yaml
142+
- name: Setup
143+
uses: mongodb-labs/drivers-github-tools/setup@v2
144+
with:
145+
...
146+
147+
- name: Export Code Scanning Alerts
148+
uses: mongodb-labs/drivers-github-tools/code-scanning-export@v2
149+
```
150+
135151
## Python Helper Scripts
136152

137153
These scripts are opinionated helper scripts for Python releases.
@@ -177,4 +193,4 @@ If `dry_run` is set, nothing will be published or pushed.
177193
product_name: winkerberos
178194
token: ${{ github.token }}
179195
dry_run: ${{ inputs.dry_run }}
180-
```
196+
```

code-scanning-export/dist/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29289,7 +29289,10 @@ async function run() {
2928929289
const alerts = await (0, api_1.getAlerts)(repositoryInfo.owner, repositoryInfo.repo, ref, core.getInput('token'));
2929029290
core.info(`Found ${alerts.length} alerts, processing now...`);
2929129291
const sarifReport = (0, sarif_1.createSarifReport)(alerts);
29292-
const filePath = path.join(process.cwd(), core.getInput('output-file'));
29292+
const outputFile = core.getInput('output-file');
29293+
const filePath = path.isAbsolute(outputFile)
29294+
? outputFile
29295+
: path.join(process.cwd(), outputFile);
2929329296
core.info(`Processing done, writing report to file ${filePath}`);
2929429297
fs.writeFileSync(filePath, JSON.stringify(sarifReport), {});
2929529298
}

code-scanning-export/src/main.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ export async function run(): Promise<void> {
3232
core.info(`Found ${alerts.length} alerts, processing now...`)
3333

3434
const sarifReport = createSarifReport(alerts)
35-
const filePath = path.join(process.cwd(), core.getInput('output-file'))
35+
const outputFile = core.getInput('output-file')
36+
const filePath = path.isAbsolute(outputFile)
37+
? outputFile
38+
: path.join(process.cwd(), outputFile)
3639

3740
core.info(`Processing done, writing report to file ${filePath}`)
3841

0 commit comments

Comments
 (0)