Skip to content

Commit 737d8e2

Browse files
authored
chore(security): Setup Advanced CodeQL workflow (#14107)
This is so that CodeQL can run against PRs from forks.
1 parent 2a00191 commit 737d8e2

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

.github/workflows/codeql.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: 'CodeQL Advanced'
2+
3+
on:
4+
push:
5+
branches: ['master']
6+
pull_request:
7+
branches: ['master']
8+
schedule:
9+
- cron: '41 14 * * 1'
10+
11+
jobs:
12+
analyze:
13+
name: Analyze (${{ matrix.language }})
14+
# Runner size impacts CodeQL analysis time. To learn more, please see:
15+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
16+
# - https://gh.io/supported-runners-and-hardware-resources
17+
# - https://gh.io/using-larger-runners (GitHub.com only)
18+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
19+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
20+
permissions:
21+
# required for all workflows
22+
security-events: write
23+
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
include:
28+
- language: actions
29+
build-mode: none
30+
- language: javascript-typescript
31+
build-mode: none
32+
- language: python
33+
build-mode: none
34+
steps:
35+
- name: Checkout repository
36+
uses: actions/checkout@v6
37+
38+
# Initializes the CodeQL tools for scanning.
39+
- name: Initialize CodeQL
40+
uses: github/codeql-action/init@v4
41+
with:
42+
languages: ${{ matrix.language }}
43+
build-mode: ${{ matrix.build-mode }}
44+
45+
- name: Run manual build steps
46+
if: matrix.build-mode == 'manual'
47+
shell: bash
48+
run: |
49+
echo 'If you are using a "manual" build mode for one or more of the' \
50+
'languages you are analyzing, replace this with the commands to build' \
51+
'your code, for example:'
52+
echo ' make bootstrap'
53+
echo ' make release'
54+
exit 1
55+
56+
- name: Perform CodeQL Analysis
57+
uses: github/codeql-action/analyze@v4
58+
with:
59+
category: '/language:${{matrix.language}}'

0 commit comments

Comments
 (0)