Skip to content

Commit eaa8da6

Browse files
authored
ci: add custom CodeQL workflow to fix dynamic scan permissions failure
1 parent d566bcb commit eaa8da6

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CodeQL
2+
3+
# The dynamic (GitHub-managed) CodeQL setup fails to upload SARIF results
4+
# because the auto-generated GITHUB_TOKEN lacks the `security-events: write`
5+
# permission. Providing an explicit workflow here tells GitHub to use this
6+
# instead of the dynamic scan, and lets us grant that permission directly.
7+
8+
on:
9+
push:
10+
branches: [main]
11+
pull_request:
12+
branches: [main]
13+
schedule:
14+
- cron: "0 12 * * 1" # every Monday at 12:00 UTC
15+
16+
permissions: {}
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
analyze:
24+
name: Analyze (${{ matrix.language }})
25+
runs-on: ubuntu-latest
26+
permissions:
27+
contents: read
28+
security-events: write # required to upload SARIF results
29+
actions: read # required for private repos; harmless for public ones
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
language: [javascript-typescript]
34+
steps:
35+
- name: Checkout repository
36+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
37+
with:
38+
persist-credentials: false
39+
40+
- name: Initialize CodeQL
41+
uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
42+
with:
43+
languages: ${{ matrix.language }}
44+
45+
- name: Autobuild
46+
uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
47+
48+
- name: Perform CodeQL Analysis
49+
uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
50+
with:
51+
category: /language:${{ matrix.language }}

0 commit comments

Comments
 (0)