Skip to content

Commit 83a8b1a

Browse files
committed
use fetch-codeql action
1 parent 3159b3d commit 83a8b1a

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

.github/actions/fetch-codeql/action.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
name: Fetch CodeQL
22
description: Fetches the latest version of CodeQL
3+
4+
inputs:
5+
channel:
6+
description: 'The CodeQL channel to use'
7+
required: false
8+
default: 'nightly'
9+
310
runs:
411
using: composite
512
steps:
613
- name: Fetch CodeQL
714
shell: bash
15+
env:
16+
GITHUB_TOKEN: ${{ github.token }}
17+
CHANNEL: ${{ inputs.channel }}
818
run: |
919
gh extension install github/gh-codeql
10-
gh codeql set-channel nightly
20+
gh codeql set-channel $CHANNEL
1121
gh codeql version
1222
gh codeql version --format=json | jq -r .unpackedLocation >> "${GITHUB_PATH}"
13-
env:
14-
GITHUB_TOKEN: ${{ github.token }}

.github/workflows/compile-queries.yml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,19 @@ jobs:
3333
restore-keys: |
3434
codeql-stable-compile-${{ env.merge-base }}
3535
codeql-stable-compile-
36-
- name: install codeql
37-
run: gh extension install github/gh-codeql
38-
env:
39-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
- name: Setup CodeQL
37+
uses: ./.github/actions/fetch-codeql
38+
with:
39+
channel: 'release'
4040
- name: check formatting
41-
run: gh codeql query format */ql/{src,lib,test}/**/*.{qll,ql} --check-only
42-
env:
43-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
run: codeql query format */ql/{src,lib,test}/**/*.{qll,ql} --check-only
4442
- name: compile queries - check-only
4543
# run with --check-only if running in a PR (github.sha != main)
4644
if : ${{ github.sha != steps.merge-base.outputs.merge-base }}
4745
shell: bash
48-
run: gh codeql query compile -j0 */ql/src --keep-going --warnings=error --check-only
49-
env:
50-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
run: codeql query compile -j0 */ql/src --keep-going --warnings=error --check-only
5147
- name: compile queries - full
5248
# do full compile if running on main - this populates the cache
5349
if : ${{ github.sha == steps.merge-base.outputs.merge-base }}
5450
shell: bash
55-
run: gh codeql query compile -j0 */ql/src --keep-going --warnings=error
56-
env:
57-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
run: codeql query compile -j0 */ql/src --keep-going --warnings=error

0 commit comments

Comments
 (0)