-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
30ddec6
commit b025421
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: "Diagnostics export" | ||
description: "Tests that diagnostics are exported to SARIF correctly." | ||
versions: ["latest"] | ||
env: | ||
CODEQL_ACTION_EXPORT_DIAGNOSTICS: true | ||
steps: | ||
- uses: ./../action/init | ||
with: | ||
languages: javascript | ||
queries: security-extended | ||
tools: ${{ steps.prepare-test.outputs.tools-url }} | ||
- uses: ./../action/analyze | ||
with: | ||
output: "${{ runner.temp }}/results" | ||
upload-database: false | ||
- name: Run `diagnostics add` | ||
shell: bash | ||
env: | ||
run: | | ||
${{steps.init.outputs.codeql-path}} diagnostics add --diagnostics-dir ${{ runner.temp }}/javascript/diagnostic --plaintext-message "Plaintext message" --source-id "lang/diagnostics/example" --source-name "Diagnostic name" | ||
- name: Upload SARIF | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: diagnostics-export-${{ matrix.os }}-${{ matrix.version }}.sarif.json | ||
path: "${{ runner.temp }}/results/javascript.sarif" | ||
retention-days: 7 | ||
# TODO(angelapwen): fill out below | ||
# https://github.com/github/semmle-code/blob/2f75f366dde13256bdd04f60728d1a2eecc4927d/odasa-buildutils/test/src/com/semmle/cli2/diagnostics/AddCommandTests.java#L133 | ||
- name: Check diagnostics appear in SARIF | ||
uses: actions/github-script@v6 | ||
env: | ||
SARIF_PATH: "${{ runner.temp }}/results/javascript.sarif" | ||
# TODO | ||
with: | ||
script: | | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8')); | ||
const run = sarif.runs[0]; | ||
core.info(run); |