Skip to content

Commit 9190943

Browse files
Run CodeQL for GitHub Actions
- Add GitHub Actions to the CodeQL analysis. - Rename jobs. - Add summary job for a single required status. - Refactor permissions.
1 parent 99883e9 commit 9190943

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

.github/workflows/codeql-analysis.yml .github/workflows/code-ql.yml

+25-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: code-scan
1+
name: code-ql
22

33
on:
44
push:
@@ -14,22 +14,21 @@ on:
1414
- cron: '0 8 * * MON'
1515
workflow_dispatch:
1616

17-
permissions:
18-
actions: read
19-
contents: read
17+
permissions: {}
2018

2119
jobs:
22-
code-ql:
23-
20+
analysis:
2421
runs-on: ubuntu-latest
2522

2623
permissions:
24+
actions: read
25+
contents: read
2726
security-events: write
2827

2928
strategy:
3029
fail-fast: false
3130
matrix:
32-
language: [ 'csharp' ]
31+
language: [ 'actions', 'csharp' ]
3332

3433
steps:
3534
- name: Checkout repository
@@ -48,3 +47,22 @@ jobs:
4847
uses: github/codeql-action/analyze@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9
4948
with:
5049
category: '/language:${{ matrix.language }}'
50+
51+
code-ql:
52+
if: ${{ !cancelled() }}
53+
needs: [ analysis ]
54+
runs-on: ubuntu-latest
55+
56+
steps:
57+
- name: Report status
58+
shell: bash
59+
env:
60+
SCAN_SUCCESS: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
61+
run: |
62+
if [ "${SCAN_SUCCESS}" == "true" ]
63+
then
64+
echo 'CodeQL analysis successful ✅'
65+
else
66+
echo '::error title=CodeQL::CodeQL analysis failed ❌'
67+
exit 1
68+
fi

0 commit comments

Comments
 (0)