From 5d288d321af2bf9aa00118f3dcaf59f29edd84a3 Mon Sep 17 00:00:00 2001 From: Dave Bartolomeo Date: Wed, 2 Nov 2022 11:10:04 -0400 Subject: [PATCH 1/6] Use latest released bundle for QL-for-QL --- .github/workflows/ql-for-ql-build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ql-for-ql-build.yml b/.github/workflows/ql-for-ql-build.yml index 53a4157973d..e3cacf73d2e 100644 --- a/.github/workflows/ql-for-ql-build.yml +++ b/.github/workflows/ql-for-ql-build.yml @@ -27,6 +27,7 @@ jobs: uses: github/codeql-action/init@71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca with: languages: javascript # does not matter + tools: latest - name: Get CodeQL version id: get-codeql-version run: | @@ -138,6 +139,7 @@ jobs: languages: ql db-location: ${{ runner.temp }}/db config-file: ./ql-for-ql-config.yml + tools: latest - name: Move pack cache run: | cp -r ${PACK}/.cache ql/ql/src/.cache From bb0b0801dde5fa69c12aac8c3d36094e7432552d Mon Sep 17 00:00:00 2001 From: Dave Bartolomeo Date: Wed, 2 Nov 2022 11:38:11 -0400 Subject: [PATCH 2/6] Try again --- .github/actions/find-latest-bundle/action.yml | 20 +++++++++++++++++++ .github/workflows/ql-for-ql-build.yml | 5 ++++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 .github/actions/find-latest-bundle/action.yml diff --git a/.github/actions/find-latest-bundle/action.yml b/.github/actions/find-latest-bundle/action.yml new file mode 100644 index 00000000000..3f4e089d476 --- /dev/null +++ b/.github/actions/find-latest-bundle/action.yml @@ -0,0 +1,20 @@ +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 --exclude-drafts --limit 1000 | + ForEach-Object { $C = $_ -split "`t"; return @{ type = $C[1]; tag = $C[2]; } } | + Where-Object { $_.type -eq 'Latest' } + + $Tag = $Latest.tag + 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 diff --git a/.github/workflows/ql-for-ql-build.yml b/.github/workflows/ql-for-ql-build.yml index e3cacf73d2e..0af98b21e09 100644 --- a/.github/workflows/ql-for-ql-build.yml +++ b/.github/workflows/ql-for-ql-build.yml @@ -22,12 +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@71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca with: languages: javascript # does not matter - tools: latest + tools: ${{ steps.find-latest-bundle.outputs.url }} - name: Get CodeQL version id: get-codeql-version run: | From 631b8fed308c23d8673a93819193053e80d42646 Mon Sep 17 00:00:00 2001 From: Dave Bartolomeo Date: Wed, 2 Nov 2022 11:40:01 -0400 Subject: [PATCH 3/6] Add token --- .github/actions/find-latest-bundle/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/find-latest-bundle/action.yml b/.github/actions/find-latest-bundle/action.yml index 3f4e089d476..669cdfb518c 100644 --- a/.github/actions/find-latest-bundle/action.yml +++ b/.github/actions/find-latest-bundle/action.yml @@ -18,3 +18,5 @@ runs: $Tag = $Latest.tag 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 }} From 906f2f5e0f3b51b864885e14c802928726bd611f Mon Sep 17 00:00:00 2001 From: Dave Bartolomeo Date: Wed, 2 Nov 2022 11:42:39 -0400 Subject: [PATCH 4/6] Add repo --- .github/actions/find-latest-bundle/action.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/actions/find-latest-bundle/action.yml b/.github/actions/find-latest-bundle/action.yml index 669cdfb518c..59e16a6d3cb 100644 --- a/.github/actions/find-latest-bundle/action.yml +++ b/.github/actions/find-latest-bundle/action.yml @@ -11,11 +11,15 @@ runs: id: find-latest shell: pwsh run: | - $Latest = gh release list --exclude-drafts --limit 1000 | + $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: From 3507cdc79666d10a3e196aa07bb0ca452ead3464 Mon Sep 17 00:00:00 2001 From: Dave Bartolomeo Date: Wed, 2 Nov 2022 12:17:24 -0400 Subject: [PATCH 5/6] Stop using `latest` for second init --- .github/workflows/ql-for-ql-build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ql-for-ql-build.yml b/.github/workflows/ql-for-ql-build.yml index 0af98b21e09..86b1aa85162 100644 --- a/.github/workflows/ql-for-ql-build.yml +++ b/.github/workflows/ql-for-ql-build.yml @@ -142,7 +142,6 @@ jobs: languages: ql db-location: ${{ runner.temp }}/db config-file: ./ql-for-ql-config.yml - tools: latest - name: Move pack cache run: | cp -r ${PACK}/.cache ql/ql/src/.cache From 966be2727eba3c546914f9b59025130b21e65f52 Mon Sep 17 00:00:00 2001 From: Dave Bartolomeo Date: Wed, 2 Nov 2022 12:22:39 -0400 Subject: [PATCH 6/6] Use correct bundle version for second init --- .github/workflows/ql-for-ql-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ql-for-ql-build.yml b/.github/workflows/ql-for-ql-build.yml index 86b1aa85162..36ca512012f 100644 --- a/.github/workflows/ql-for-ql-build.yml +++ b/.github/workflows/ql-for-ql-build.yml @@ -142,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