Skip to content

Commit 281871c

Browse files
Add CodeQL analysis for GitHub Actions
- Add CodeQL analysis for GitHub Actions. - Refactor permissions. - Add overall job/status for all languages. - Standardize workflow with other repos.
1 parent 6886e57 commit 281871c

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

.github/workflows/code-scan.yml renamed to .github/workflows/codeql.yml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: code-scan
1+
name: codeql
22

33
on:
44
push:
@@ -10,23 +10,23 @@ on:
1010
- dotnet-nightly
1111
schedule:
1212
- cron: '0 6 * * 1'
13+
workflow_dispatch:
1314

14-
permissions:
15-
actions: read
16-
contents: read
15+
permissions: {}
1716

1817
jobs:
19-
code-ql:
20-
18+
analysis:
2119
runs-on: ubuntu-latest
2220

2321
permissions:
22+
actions: read
23+
contents: read
2424
security-events: write
2525

2626
strategy:
2727
fail-fast: false
2828
matrix:
29-
language: [ 'csharp', 'javascript' ]
29+
language: [ 'actions', 'csharp', 'javascript' ]
3030

3131
steps:
3232
- name: Checkout repository
@@ -43,3 +43,22 @@ jobs:
4343
uses: github/codeql-action/analyze@v3
4444
with:
4545
category: '/language:${{ matrix.language }}'
46+
47+
codeql:
48+
if: ${{ !cancelled() }}
49+
needs: [ analysis ]
50+
runs-on: ubuntu-latest
51+
52+
steps:
53+
- name: Report status
54+
shell: bash
55+
env:
56+
SCAN_SUCCESS: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
57+
run: |
58+
if [ "${SCAN_SUCCESS}" == "true" ]
59+
then
60+
echo 'CodeQL analysis successful ✅'
61+
else
62+
echo 'CodeQL analysis failed ❌'
63+
exit 1
64+
fi

0 commit comments

Comments
 (0)