-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (63 loc) · 2.1 KB
/
codeql.yml
File metadata and controls
73 lines (63 loc) · 2.1 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
name: "CodeQL"
on:
push:
branches: ["**"]
pull_request:
schedule:
- cron: "0 0 * * 1" # Run every Monday at midnight
permissions:
contents: read
jobs:
pr-check:
name: Check for open PR
if: github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
has_pr: ${{ steps.find-pr.outputs.has_pr }}
steps:
- name: Find open PR for branch
id: find-pr
uses: actions/github-script@v8.0.0
with:
script: |
const branch = context.ref.replace('refs/heads/', '');
const { data: prs } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
head: `${context.repo.owner}:${branch}`,
});
core.setOutput('has_pr', prs.length > 0 ? 'true' : 'false');
analyze:
name: Analyze
needs: [pr-check]
if: ${{ always() && (github.event_name == 'pull_request' || needs.pr-check.outputs.has_pr != 'true') }}
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
actions: read
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
with:
go-version-file: "go.mod"
- name: Initialize CodeQL
uses: github/codeql-action/init@19b2f06db2b6f5108140aeb04014ef02b648f789 # v4.31.11
with:
languages: go
- name: Autobuild
uses: github/codeql-action/autobuild@19b2f06db2b6f5108140aeb04014ef02b648f789 # v4.31.11
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@19b2f06db2b6f5108140aeb04014ef02b648f789 # v4.31.11
with:
category: "/language:go"