-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (76 loc) · 3.03 KB
/
Copy pathcodeql.yml
File metadata and controls
87 lines (76 loc) · 3.03 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
name: CodeQL
# CodeQL advanced setup, replacing default setup (ORB-164).
#
# Default setup does not run on Dependabot pull requests (github/codeql-action
# issue 2858), so the three contexts branch protection requires on main,
# "Analyze (csharp)", "Analyze (javascript-typescript)" and "Analyze (actions)",
# never reported on a Dependabot head and every Dependabot pull request stayed
# permanently BLOCKED. An advanced-setup workflow is an ordinary workflow, so it
# triggers on a Dependabot head like every other job in this repository, and the
# job-level permissions block below is honoured there. GitHub's "Troubleshooting
# Dependabot on GitHub Actions" documents both halves: a Dependabot-triggered run
# "receives a read-only GITHUB_TOKEN and does not have access to any secrets", and
# "you can use the permissions key in your workflow to increase the access for the
# token", which is exactly what the analyze job does for security-events.
#
# The job name is load bearing. A matrix job produces one check run per leg,
# named by interpolating the job name, so "Analyze (${{ matrix.language }})"
# over these three languages reproduces the three required contexts verbatim.
# Renaming this job, or changing a matrix language value, silently makes main
# unmergeable for every pull request.
#
# The language set matches what default setup covered: csharp,
# javascript-typescript and actions. C# is analyzed with a real build rather
# than buildless extraction, because this repository generates code at build
# time (LoggerMessage source generators, openapi.json) and because a
# GitHub-side feature flag can turn build-mode "none" into "autobuild" without
# warning. The build steps are the ones API Tests already proves.
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "0 5 * * 1"
permissions:
contents: read
jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest
timeout-minutes: 45
permissions:
security-events: write
actions: read
contents: read
strategy:
fail-fast: false
matrix:
include:
- language: csharp
build-mode: manual
- language: javascript-typescript
build-mode: none
- language: actions
build-mode: none
steps:
- uses: actions/checkout@v7
- name: Setup .NET
if: matrix.build-mode == 'manual'
uses: actions/setup-dotnet@v6
with:
dotnet-version: "10.0.x"
- name: Initialize CodeQL
uses: github/codeql-action/init@f205ea1c3313d32999d8d6a48b4f6530d4437b38 # v4.37.4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
- name: Build
if: matrix.build-mode == 'manual'
run: |
dotnet restore
dotnet build --no-restore
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@f205ea1c3313d32999d8d6a48b4f6530d4437b38 # v4.37.4
with:
category: "/language:${{ matrix.language }}"