From 94cf1cd2c8d82408890233f183b9fa2a5776f0bd Mon Sep 17 00:00:00 2001 From: Ryan Foster Date: Thu, 30 Mar 2023 16:29:51 -0400 Subject: [PATCH] CI: Fix GitHub labels check github.event.pull_request.labels contains the labels at the time the pull_request event was triggered. Modifications made during the workflow (or after the PR was submitted and before a CI re-run) won't show up there. To reliably check the labels on CI re-runs, switch back to checking the API. --- .github/workflows/main.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5aeb58969..fb0092b34 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -68,7 +68,11 @@ jobs: id: config run: | if [[ "${{ github.event_name == 'pull_request' }}" == "true" ]]; then - echo "create_artifacts=${{ contains(github.event.pull_request.labels.*.name, 'Seeking Testers') }}" >> $GITHUB_OUTPUT + if test -n "$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -s "${{ github.event.pull_request.url }}" | jq -e '.labels[] | select(.name == "Seeking Testers")')"; then + echo 'create_artifacts=true' >> $GITHUB_OUTPUT + else + echo 'create_artifacts=false' >> $GITHUB_OUTPUT + fi else echo 'create_artifacts=true' >> $GITHUB_OUTPUT fi @@ -102,7 +106,7 @@ jobs: id: github-check if: github.event_name == 'pull_request' run: | - if [[ '${{ contains(github.event.pull_request.labels.*.name, 'Seeking Testers') }}' == 'true' ]]; then + if test -n "$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -s "${{ github.event.pull_request.url }}" | jq -e '.labels[] | select(.name == "Seeking Testers")')"; then echo "generator=Xcode" >> $GITHUB_OUTPUT else echo "generator=Ninja" >> $GITHUB_OUTPUT @@ -550,7 +554,7 @@ jobs: id: branch run: | pushd repo - + GIT_TAG="$(git describe --tags --abbrev=0)" if [[ ${GIT_TAG} == *'beta'* || ${GIT_TAG} == *'rc'* ]]; then echo "branch=beta" >> $GITHUB_OUTPUT