Repository navigation
103 lines (91 loc) · 3.32 KB
/
Copy pathcodeql.yml
File metadata and controls
103 lines (91 loc) · 3.32 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
name: CodeQL
on:
push:
branches:
- main
- next
pull_request:
branches:
- main
- next
merge_group:
types:
- checks_requested
permissions: {}
jobs:
source:
uses: ./.github/workflows/prepare-ci-source.yml
with:
current-pr-merge: true
permissions:
contents: read
actions: read
analyze:
name: CodeQL analysis (${{ matrix.language }})
runs-on: ubuntu-latest
timeout-minutes: 30
needs: source
permissions: {}
env:
# The pinned action otherwise reads the private workflow-run API to infer
# this fixed workflow/job identity during SARIF post-processing.
CODEQL_ACTION_ANALYSIS_KEY: .github/workflows/codeql.yml:analyze
strategy:
fail-fast: false
matrix:
include:
- language: actions
build-mode: none
- language: go
build-mode: autobuild
- language: javascript-typescript
build-mode: none
- language: python
build-mode: none
steps:
- name: Download prepared source
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
with:
artifact-ids: ${{ needs.source.outputs.artifact-id }}
path: ${{ runner.temp }}/ci-inputs
merge-multiple: true
- name: Restore candidate checkout
shell: bash
run: tar -xzf - < "$RUNNER_TEMP/ci-inputs/ci-source.tar.gz"
- name: Test CodeQL source and publication boundaries
if: matrix.language == 'actions'
run: python3 -B -I -m unittest discover -s .github/scripts -p 'test_codeql*.py'
- name: Set up Go for internal cross-linking
if: matrix.language == 'go' && github.repository == 'openai/openai-cli-internal' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.id == github.event.repository.id && github.event.pull_request.base.ref == 'main'
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: .go-version
check-latest: true
- uses: ./.github/actions/link-go-sdk
if: matrix.language == 'go'
- name: Initialize CodeQL
uses: github/codeql-action/init@24c54180a607b1449ed407dd24f251e4e9147c8d # v4.38.3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
- name: Analyze
uses: github/codeql-action/analyze@24c54180a607b1449ed407dd24f251e4e9147c8d # v4.38.3
with:
upload: never
upload-database: false
output: ${{ runner.temp }}/codeql-raw
post-processed-sarif-path: ${{ runner.temp }}/codeql-sarif
- name: Record analyzed revision
env:
CODEQL_LANGUAGE: ${{ matrix.language }}
SARIF_DIRECTORY: ${{ runner.temp }}/codeql-sarif
run: python3 -I .github/scripts/codeql_upload.py record
- name: Stage CodeQL results
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: codeql-sarif-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.language }}
path: |
${{ runner.temp }}/codeql-sarif/upload.sarif
${{ runner.temp }}/codeql-sarif/context.json
if-no-files-found: error
retention-days: 7