Skip to content

Commit 95fcab6

Browse files
authored
feat: codeql advanced (#1322)
1 parent 37653ec commit 95fcab6

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed

.github/workflows/codeql.yaml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: "CodeQL Advanced"
2+
3+
on:
4+
pull_request:
5+
schedule:
6+
- cron: "22 22 * * 2"
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
filter:
14+
name: Detect Changes
15+
permissions:
16+
contents: read
17+
pull-requests: read
18+
outputs:
19+
should-run-go: ${{ steps.changes.outputs.go-changes == 'true' || steps.changes.outputs.self-changes == 'true' || github.event_name == 'schedule' }}
20+
should-run-python: ${{ steps.changes.outputs.python-changes == 'true' || steps.changes.outputs.self-changes == 'true' || github.event_name == 'schedule' }}
21+
should-run-js-ts: ${{ steps.changes.outputs.js-ts-changes == 'true' || steps.changes.outputs.self-changes == 'true' || github.event_name == 'schedule' }}
22+
should-run-actions: ${{ steps.changes.outputs.actions-changes == 'true' || github.event_name == 'schedule' }} # includes self-changes
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout the repo
26+
uses: actions/checkout@v4
27+
with:
28+
persist-credentials: false
29+
fetch-depth: 0
30+
31+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
32+
id: changes
33+
with:
34+
list-files: shell
35+
filters: |
36+
go-changes:
37+
- '**/*.go'
38+
- '**/go.mod'
39+
- '**/go.sum'
40+
python-changes:
41+
- '**/*.py'
42+
- '**/requirements.txt'
43+
js-ts-changes:
44+
- '**/pnpm-lock.yaml'
45+
- '**/*.js'
46+
- '**/*.ts'
47+
- '**/tsconfig.json'
48+
actions-changes:
49+
- '.github/workflows/**/*.yml'
50+
- '.github/workflows/**/*.yaml'
51+
- '**/action.yml'
52+
- '**/action.yaml'
53+
self-changes:
54+
- '.github/workflows/codeql.yaml'
55+
56+
analyze:
57+
name: Analyze (${{ matrix.language }})
58+
runs-on: "ubuntu-latest"
59+
permissions:
60+
contents: read
61+
# required for all workflows
62+
security-events: write
63+
# required to fetch internal or private CodeQL packs
64+
packages: read
65+
# required to get workflow run info via API
66+
actions: read
67+
# required for assumiming AWS IAM roles with OIDC
68+
id-token: write
69+
needs: filter
70+
71+
strategy:
72+
fail-fast: false
73+
matrix:
74+
include:
75+
- language: go
76+
should-run: ${{ needs.filter.outputs.should-run-go }}
77+
build-mode: autobuild
78+
79+
- language: python
80+
should-run: ${{ needs.filter.outputs.should-run-python }}
81+
82+
- language: javascript-typescript
83+
should-run: ${{ needs.filter.outputs.should-run-js-ts }}
84+
85+
- language: actions
86+
should-run: ${{ needs.filter.outputs.should-run-actions }}
87+
88+
steps:
89+
- name: Checkout repository
90+
if: matrix.should-run
91+
uses: actions/checkout@v4
92+
93+
# Initializes the CodeQL tools for scanning.
94+
- name: Initialize CodeQL
95+
if: matrix.should-run
96+
uses: github/codeql-action/init@v4
97+
with:
98+
languages: ${{ matrix.language }}
99+
build-mode: ${{ matrix.build-mode || '' }}
100+
101+
- name: Perform CodeQL Analysis
102+
if: matrix.should-run
103+
uses: github/codeql-action/analyze@v4
104+
with:
105+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)