Repository navigation
113 lines (103 loc) · 3.53 KB
/
Copy pathcodeql.yml
File metadata and controls
113 lines (103 loc) · 3.53 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
109
110
111
112
113
name: CodeQL
# Replaces CodeQL default setup, which must stay disabled: GitHub rejects
# uploads from this workflow while default setup is on.
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "23 4 * * 1"
workflow_dispatch:
concurrency:
# Every push to main runs: each one analyzes only what its own commit
# changed, so a run replaced while pending would leave that change unscanned.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
changes:
name: CodeQL changes
if: github.event_name == 'pull_request' || github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
actions: ${{ steps.filter.outputs.actions }}
javascript: ${{ steps.filter.outputs.javascript }}
rust: ${{ steps.filter.outputs.rust }}
steps:
# Pull requests list their files through the API; a push diffs in git.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
if: github.event_name == 'push'
with:
persist-credentials: false
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
id: filter
with:
filters: |
self: &self
- .github/workflows/codeql.yml
actions:
- .github/**
javascript:
- *self
- packages/**
- "**/*.{js,mjs,cjs,ts,mts,cts}"
- package.json
- package-lock.json
rust:
- *self
- crates/**
- "**/*.rs"
- Cargo.toml
- Cargo.lock
# One job per language rather than a matrix, because a job's `if:` cannot
# read `matrix`. The names match the ones default setup used.
actions:
name: Analyze (actions)
needs: changes
if: ${{ !cancelled() && (needs.changes.result == 'skipped' || needs.changes.outputs.actions == 'true') }}
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
env:
LANGUAGE: actions
steps: &analyze
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: github/codeql-action/init@6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee # v4.39.0
with:
languages: ${{ env.LANGUAGE }}
build-mode: none
- uses: github/codeql-action/analyze@6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee # v4.39.0
with:
category: /language:${{ env.LANGUAGE }}
javascript:
name: Analyze (javascript-typescript)
needs: changes
if: ${{ !cancelled() && (needs.changes.result == 'skipped' || needs.changes.outputs.javascript == 'true') }}
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
env:
LANGUAGE: javascript-typescript
steps: *analyze
# The slowest analysis, and so far it has raised only path-injection alerts
# on paths rw serves by design, so pull requests skip it.
rust:
name: Analyze (rust)
needs: changes
if: ${{ !cancelled() && github.event_name != 'pull_request' && (needs.changes.result == 'skipped' || needs.changes.outputs.rust == 'true') }}
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
env:
LANGUAGE: rust
steps: *analyze