Skip to content

Commit 86cf056

Browse files
authored
Merge pull request #58 from advanced-security/mbaluda-sarif-diff
Add sarif-diff to Code Scanning workflow
2 parents a301cd6 + 8a37625 commit 86cf056

File tree

2 files changed

+21500
-3
lines changed

2 files changed

+21500
-3
lines changed

.github/workflows/code_scanning.yml

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,49 @@ jobs:
3535
mv $dir .github/codeql/extensions/$dir
3636
done
3737
38-
3938
# Initializes the CodeQL tools for scanning.
4039
- name: Initialize CodeQL
41-
uses: github/codeql-action/init@v2
40+
uses: github/codeql-action/init@v3
4241
with:
4342
languages: javascript
4443
config-file: ./.github/codeql/codeql-config.yaml
4544
debug: true
4645

4746
- name: Perform CodeQL Analysis
48-
uses: github/codeql-action/analyze@v2
47+
id: analyze
48+
uses: github/codeql-action/analyze@v3
49+
50+
- name: Setup Python
51+
uses: actions/setup-python@v5
52+
with:
53+
python-version: '3.10'
54+
55+
- uses: actions/cache@v4
56+
with:
57+
path: ~/.cache/pip
58+
key: ${{ runner.os }}-pip
59+
60+
- name: Validate results
61+
continue-on-error: true
62+
id: validate
63+
run: |
64+
pip install sarif-tools
65+
sarif --version
66+
sarif diff ${{ steps.analyze.outputs.sarif-output }} .github/workflows/javascript.sarif.expected -o sarif-diff.json
67+
! grep -q "[1-9]" sarif-diff.json
68+
69+
- name: Upload sarif change
70+
if: steps.validate.outcome != 'success'
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: sarif
74+
path: |
75+
sarif-diff.json
76+
${{ steps.analyze.outputs.sarif-output }}
77+
78+
- name: Unexpected Code Scanning results
79+
if: steps.validate.outcome != 'success'
80+
run: |
81+
cat sarif-diff.json
82+
echo "::error::Unexpected Code Scanning results!" && exit 1
83+

0 commit comments

Comments
 (0)