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.
This commit is contained in:
Ryan Foster 2023-03-30 16:29:51 -04:00
parent 0315c357f6
commit 94cf1cd2c8

View file

@ -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