-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (57 loc) · 1.89 KB
/
Copy pathcodeql.yml
File metadata and controls
65 lines (57 loc) · 1.89 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
name: CodeQL
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '27 3 * * 1'
permissions:
contents: read
concurrency:
group: codeql-${{ github.ref }}
cancel-in-progress: true
jobs:
analyze:
name: Analyze (javascript-typescript)
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [javascript-typescript]
steps:
- name: Harden runner
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Initialize CodeQL
uses: github/codeql-action/init@f205ea1c3313d32999d8d6a48b4f6530d4437b38 # v4.37.4
with:
languages: ${{ matrix.language }}
queries: security-extended
# Code scanning upload needs GitHub Advanced Security on private repositories.
# Gate the upload on visibility so analysis always runs, and results upload
# automatically once the repository is public — no workflow change required.
- name: Resolve code scanning upload mode
id: scanning
env:
GH_TOKEN: ${{ github.token }}
run: |
visibility="$(gh api "repos/${{ github.repository }}" --jq '.visibility')"
if [ "$visibility" = "public" ]; then
echo 'upload=always' >> "$GITHUB_OUTPUT"
else
echo 'upload=never' >> "$GITHUB_OUTPUT"
fi
- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@f205ea1c3313d32999d8d6a48b4f6530d4437b38 # v4.37.4
with:
category: '/language:${{ matrix.language }}'
upload: ${{ steps.scanning.outputs.upload }}