diff --git a/.github/actions/find-latest-bundle/action.yml b/.github/actions/find-latest-bundle/action.yml new file mode 100644 index 00000000000..59e16a6d3cb --- /dev/null +++ b/.github/actions/find-latest-bundle/action.yml @@ -0,0 +1,26 @@ +name: Find Latest CodeQL Bundle +description: Finds the URL of the latest released version of the CodeQL bundle. +outputs: + url: + description: The download URL of the latest CodeQL bundle release + value: ${{ steps.find-latest.outputs.url }} +runs: + using: composite + steps: + - name: Find Latest Release + id: find-latest + shell: pwsh + run: | + $Latest = gh release list --repo github/codeql-action --exclude-drafts --limit 1000 | + ForEach-Object { $C = $_ -split "`t"; return @{ type = $C[1]; tag = $C[2]; } } | + Where-Object { $_.type -eq 'Latest' } + + $Tag = $Latest.tag + if ($Tag -eq '') { + throw 'Failed to find latest bundle release.' + } + + Write-Output "Latest bundle tag is '${Tag}'." + "url=https://github.com/github/codeql-action/releases/download/${Tag}/codeql-bundle-linux64.tar.gz" >> $env:GITHUB_OUTPUT + env: + GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/ql-for-ql-build.yml b/.github/workflows/ql-for-ql-build.yml index 701dc4d612c..29b8bc16300 100644 --- a/.github/workflows/ql-for-ql-build.yml +++ b/.github/workflows/ql-for-ql-build.yml @@ -22,11 +22,15 @@ jobs: steps: ### Build the queries ### - uses: actions/checkout@v3 + - name: Find latest bundle + id: find-latest-bundle + uses: ./.github/actions/find-latest-bundle - name: Find codeql id: find-codeql uses: github/codeql-action/init@77a8d2d10c0b403a8b4aadbd223dc489ecd22683 with: languages: javascript # does not matter + tools: ${{ steps.find-latest-bundle.outputs.url }} - name: Get CodeQL version id: get-codeql-version run: | @@ -138,6 +142,7 @@ jobs: languages: ql db-location: ${{ runner.temp }}/db config-file: ./ql-for-ql-config.yml + tools: ${{ steps.find-latest-bundle.outputs.url }} - name: Move pack cache run: | cp -r ${PACK}/.cache ql/ql/src/.cache