-
Notifications
You must be signed in to change notification settings - Fork 1
108 lines (99 loc) · 3.42 KB
/
Copy pathcodeql.yml
File metadata and controls
108 lines (99 loc) · 3.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: CodeQL
on:
# paths-ignore skips CodeQL on doc-only changes. The scheduled
# weekly run (cron below) continues to cover main regardless, so
# there is no security-analysis blind spot for doc-heavy weeks.
# Branch protection should require `codeql-complete` (the sentinel
# at the bottom) rather than the individual Analyze jobs.
push:
branches: [main]
paths-ignore:
- '**.md'
- 'docs/**'
- 'rfcs/**'
- 'LICENSE*'
- 'NOTICE'
- '.github/ISSUE_TEMPLATE/**'
- '.github/PULL_REQUEST_TEMPLATE*'
# Repo-meta files that can't affect the analysed source.
- '.gitignore'
- '.gitattributes'
- '.mailmap'
- '.editorconfig'
- 'CODEOWNERS'
- '.github/CODEOWNERS'
- '.github/dependabot.yml'
- '.github/release-drafter.yml'
pull_request:
paths-ignore:
- '**.md'
- 'docs/**'
- 'rfcs/**'
- 'LICENSE*'
- 'NOTICE'
- '.github/ISSUE_TEMPLATE/**'
- '.github/PULL_REQUEST_TEMPLATE*'
# Repo-meta files that can't affect the analysed source.
- '.gitignore'
- '.gitattributes'
- '.mailmap'
- '.editorconfig'
- 'CODEOWNERS'
- '.github/CODEOWNERS'
- '.github/dependabot.yml'
- '.github/release-drafter.yml'
schedule:
- cron: "0 6 * * 1"
# Workflow-level default matches the sentinel job. The `analyze` job
# widens to `actions: read` + `security-events: write` as it needs
# both (read the workflow run metadata + upload the SARIF).
permissions:
contents: read
jobs:
analyze:
name: Analyze ${{ matrix.language }}
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [actions, rust]
steps:
# Action pins track supply-chain hardening (CodeQL's own
# security-and-quality rule). Tag comments name the version each
# SHA resolves to — refresh via `gh api repos/<owner>/<repo>/
# git/ref/tags/<tag>` and dereference annotated tags.
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Initialize CodeQL
uses: github/codeql-action/init@ce64ddcb0d8d890d2df4a9d1c04ff297367dea2a # v3.35.2
with:
languages: ${{ matrix.language }}
queries: security-and-quality
- name: Autobuild
uses: github/codeql-action/autobuild@ce64ddcb0d8d890d2df4a9d1c04ff297367dea2a # v3.35.2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@ce64ddcb0d8d890d2df4a9d1c04ff297367dea2a # v3.35.2
with:
category: "/language:${{ matrix.language }}"
# Always-runs sentinel. Branch protection should require
# `codeql-complete` — not the per-language Analyze jobs — so
# paths-ignore skips and scheduled runs both report a single
# stable required check. `needs.analyze.result` is `skipped` when
# the path filter matches and `success` on a clean analysis.
codeql-complete:
name: codeql-complete
needs: analyze
if: always()
runs-on: ubuntu-latest
steps:
- name: Aggregate analysis result
env:
ANALYZE_RESULT: ${{ needs.analyze.result }}
run: |
case "$ANALYZE_RESULT" in
success|skipped) echo "analyze: $ANALYZE_RESULT — ok"; exit 0 ;;
*) echo "analyze: $ANALYZE_RESULT — blocking merge" >&2; exit 1 ;;
esac