Skip to content

Upgrade supported CodeQL configuration #15

Upgrade supported CodeQL configuration

Upgrade supported CodeQL configuration #15

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@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7.0.6
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 }}"