forked from github/codeql-coding-standards
-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (60 loc) · 2.88 KB
/
upgrade_codeql_dependencies.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
name: Upgrade supported CodeQL configuration
on:
workflow_dispatch:
inputs:
codeql_cli_version:
description: |
The version of the CodeQL CLI to be set as the default.
required: true
env:
XARGS_MAX_PROCS: 4
jobs:
upgrade_codeql_dependencies:
env:
CODEQL_CLI_VERSION: ${{ github.event.inputs.codeql_cli_version }}
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Fetch CodeQL
env:
GITHUB_TOKEN: ${{ github.token }}
RUNNER_TEMP: ${{ runner.temp }}
run: |
cd $RUNNER_TEMP
gh release download "v${CODEQL_CLI_VERSION}" --repo https://github.com/github/codeql-cli-binaries --pattern codeql-linux64.zip
unzip -q codeql-linux64.zip
echo "$RUNNER_TEMP/codeql/" >> $GITHUB_PATH
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install upgrade-codeql-dependencies.py dependencies
run: pip install -r scripts/upgrade-codeql-dependencies/requirements.txt
- name: Update the supported environment
env:
GITHUB_TOKEN: ${{ github.token }}
CODEQL_CLI_VERSION: ${{ github.event.inputs.codeql_cli_version }}
run: |
python3 scripts/upgrade-codeql-dependencies/upgrade-codeql-dependencies.py --cli-version "$CODEQL_CLI_VERSION"
- name: Update CodeQL formatting based on new CLI version
env:
RUNNER_TEMP: ${{ runner.temp }}
run: |
find cpp \( -name '*.ql' -or -name '*.qll' \) -print0 | xargs -0 --max-procs "$XARGS_MAX_PROCS" codeql query format --in-place
find c \( -name '*.ql' -or -name '*.qll' \) -print0 | xargs -0 --max-procs "$XARGS_MAX_PROCS" codeql query format --in-place
- name: Create Pull Request
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
with:
title: "Upgrade `github/codeql` dependency to ${{ github.event.inputs.codeql_cli_version }}"
body: |
This PR upgrades the CodeQL CLI version to ${{ github.event.inputs.codeql_cli_version }}.
## CodeQL dependency upgrade checklist:
- [ ] Confirm the code has been correctly reformatted according to the new CodeQL CLI.
- [ ] Identify any CodeQL compiler warnings and errors, and update queries as required.
- [ ] Validate that the `github/codeql` test cases succeed.
- [ ] Address any CodeQL test failures in the `github/codeql-coding-standards` repository.
- [ ] Validate performance vs pre-upgrade, using /test-performance
commit-message: "Upgrading `github/codeql` dependency to ${{ github.event.inputs.codeql_cli_version }}"
delete-branch: true
branch: "codeql/upgrade-to-${{ github.event.inputs.codeql_cli_version }}"