Skip to content

Commit 5eddbb9

Browse files
Add CodeQL (#188)
Add GitHub Actions workflow to run CodeQL for GitHub Actions and C#.
1 parent d0d9c28 commit 5eddbb9

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

.github/workflows/codeql.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: codeql
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths-ignore:
7+
- '**.md'
8+
pull_request:
9+
branches: [ main ]
10+
schedule:
11+
- cron: '0 6 * * MON'
12+
workflow_dispatch:
13+
14+
permissions: {}
15+
16+
jobs:
17+
analysis:
18+
runs-on: ubuntu-latest
19+
20+
permissions:
21+
actions: read
22+
contents: read
23+
security-events: write
24+
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
language: [ 'actions', 'csharp' ]
29+
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
33+
with:
34+
filter: 'tree:0'
35+
persist-credentials: false
36+
show-progress: false
37+
38+
- name: Initialize CodeQL
39+
uses: github/codeql-action/init@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
40+
with:
41+
build-mode: none
42+
languages: ${{ matrix.language }}
43+
queries: security-and-quality
44+
45+
- name: Perform CodeQL Analysis
46+
uses: github/codeql-action/analyze@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
47+
with:
48+
category: '/language:${{ matrix.language }}'
49+
50+
codeql:
51+
if: ${{ !cancelled() }}
52+
needs: [ analysis ]
53+
runs-on: ubuntu-latest
54+
55+
steps:
56+
- name: Report status
57+
shell: bash
58+
env:
59+
SCAN_SUCCESS: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
60+
run: |
61+
if [ "${SCAN_SUCCESS}" == "true" ]
62+
then
63+
echo 'CodeQL analysis successful ✅'
64+
else
65+
echo 'CodeQL analysis failed ❌'
66+
exit 1
67+
fi

0 commit comments

Comments
 (0)