-
Notifications
You must be signed in to change notification settings - Fork 176
82 lines (73 loc) · 2.37 KB
/
codeql.yml
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
name: CodeQL
on:
schedule:
- cron: '0 0 * * *'
push:
branches: [ main, release-*, releasing-* ]
env:
BASE_BRANCH: origin/main
GO_VERSION: "1.21"
jobs:
trigger-mode:
runs-on: ubuntu-latest
outputs:
trigger-mode: ${{ steps.get_trigger_mode.outputs.trigger_mode }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get trigger mode
id: get_trigger_mode
run: |
TRIGGER_MODE="[go]"
if [[ "${{ github.event_name }}" == 'pull_request' ]]; then
TRIGGER_MODE=`bash .github/utils/utils.sh --type 6 \
--branch-name "${{ github.event.pull_request.head.ref }}" \
--base-commit "${{ github.event.pull_request.base.sha }}"`
elif [[ "${{ github.event_name }}" == 'push' ]]; then
TRIGGER_MODE=`bash .github/utils/utils.sh --type 6 \
--branch-name "${{ github.ref_name }}" \
--base-branch "${{ env.BASE_BRANCH }}"`
fi
echo $TRIGGER_MODE
echo trigger_mode=$TRIGGER_MODE >> $GITHUB_OUTPUT
analyze:
name: Analyze
needs: trigger-mode
if: contains(needs.trigger-mode.outputs.trigger-mode, '[go]')
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'go' ]
steps:
- uses: actions/checkout@v4
- name: install lib
run: |
sudo rm /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libbtrfs-dev \
libdevmapper-dev
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "${{ env.GO_VERSION }}"
- name: make generate
run: |
make generate test-go-generate
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"