-
Notifications
You must be signed in to change notification settings - Fork 7
84 lines (75 loc) · 2.85 KB
/
Copy pathcodeql.yml
File metadata and controls
84 lines (75 loc) · 2.85 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
# CodeQL static analysis for PARTHA.
#
# Part of the dependency, secret, and code scanning baseline. Intended to become
# a required status check on `dev` and `main` once branch protection is enabled.
name: CodeQL
on:
# Analysing the default branch on every push is what keeps the Security tab
# current. Without this, `dev`'s own analysis only refreshed on the weekly
# cron, so the Code scanning page reported "warnings detected in 2
# configurations" — the scans were 5 days and 37 commits stale, not finding
# anything. PR runs analyse a merge ref, which never updates the branch's
# own result.
push:
branches:
- dev
- main
pull_request:
branches:
- dev
- main
schedule:
# Weekly, Monday 03:17 UTC. Off-the-hour on purpose: GitHub drops scheduled
# runs when too many land on the same minute.
#
# Scheduled workflows only ever run on the default branch, which is now
# `dev`. This backstop catches newly-published CodeQL queries finding
# issues in code that has not changed; the push trigger above is what keeps
# results fresh as work lands.
- cron: '17 3 * * 1'
# Least privilege by default; the analyze job widens only what it needs.
permissions:
contents: read
# A newer push to the same PR makes an in-flight scan irrelevant. Keyed on the
# ref, so a push run on `dev` (refs/heads/dev) and a PR run (refs/pull/N/merge)
# never cancel each other.
#
# Default-branch runs are never cancelled: that result is what the Security tab
# reports, and cancelling one during a run of merges would leave it stale again
# — the exact problem the push trigger exists to fix.
concurrency:
group: codeql-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/dev' && github.ref != 'refs/heads/main' }}
jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
# Required to upload results to the Security tab.
security-events: write
# Required by the CodeQL action to look up workflow run status.
actions: read
contents: read
strategy:
fail-fast: false
matrix:
include:
# `build-mode: none` is correct for interpreted languages — CodeQL
# analyses the source directly and no compilation step is needed.
- language: javascript-typescript
build-mode: none
- language: python
build-mode: none
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{ matrix.language }}"