Skip to content

Code Scanning Alert Documentation and fixes #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,22 @@ This action will download an Augmented SBOM file in `$RELEASE_ASSETS/sbom.json`.
silk_asset_group: mongodb-python-driver
```

### Code Scanning Alerts

This action will export all dismissed and open alerts to a SARIF file. By
default, this file is named `code-scanning-alerts.json` and placed in the
working directory.

```yaml
- name: Setup
uses: mongodb-labs/drivers-github-tools/setup@v2
with:
...

- name: Export Code Scanning Alerts
uses: mongodb-labs/drivers-github-tools/code-scanning-export@v2
```

## Python Helper Scripts

These scripts are opinionated helper scripts for Python releases.
Expand Down Expand Up @@ -177,4 +193,4 @@ If `dry_run` is set, nothing will be published or pushed.
product_name: winkerberos
token: ${{ github.token }}
dry_run: ${{ inputs.dry_run }}
```
```
5 changes: 4 additions & 1 deletion code-scanning-export/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29289,7 +29289,10 @@ async function run() {
const alerts = await (0, api_1.getAlerts)(repositoryInfo.owner, repositoryInfo.repo, ref, core.getInput('token'));
core.info(`Found ${alerts.length} alerts, processing now...`);
const sarifReport = (0, sarif_1.createSarifReport)(alerts);
const filePath = path.join(process.cwd(), core.getInput('output-file'));
const outputFile = core.getInput('output-file');
const filePath = path.isAbsolute(outputFile)
? outputFile
: path.join(process.cwd(), outputFile);
core.info(`Processing done, writing report to file ${filePath}`);
fs.writeFileSync(filePath, JSON.stringify(sarifReport), {});
}
Expand Down
5 changes: 4 additions & 1 deletion code-scanning-export/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ export async function run(): Promise<void> {
core.info(`Found ${alerts.length} alerts, processing now...`)

const sarifReport = createSarifReport(alerts)
const filePath = path.join(process.cwd(), core.getInput('output-file'))
const outputFile = core.getInput('output-file')
const filePath = path.isAbsolute(outputFile)
? outputFile
: path.join(process.cwd(), outputFile)

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

Expand Down
Loading