From 5eea8355baa64e6fda4e3874a0f45649d4c27633 Mon Sep 17 00:00:00 2001 From: thorimur <68410468+thorimur@users.noreply.github.com> Date: Sat, 14 Sep 2024 04:14:08 -0400 Subject: [PATCH] fix: set check level correctly during workflow (#5344) Fixes a workflow bug where the `check-level` was not always set correctly. Arguments to a `gh` call used to determine the `check_level` were accidentally outside of the relevant command substitution (`$(gh ...)`). ----- This can be observed in [these logs](https://github.com/leanprover/lean4/actions/runs/10859763037/job/30139540920), where the check level (shown first under "configure build matrix") is `2`, but the PR does not have the `release-ci` tag. As a "test", run the script for "set check level" printed in those logs (with some lines omitted): ``` check_level=0 labels="$(gh api repos/leanprover/lean4/pulls/5343) --jq '.labels'" if echo "$labels" | grep -q "release-ci"; then check_level=2 elif echo "$labels" | grep -q "merge-ci"; then check_level=1 fi echo "check_level=$check_level" ``` Note that this prints `check_level=2`, but changing `labels` to `labels="$(gh api repos/leanprover/lean4/pulls/5343 --jq '.labels')"` prints `check_level=0`. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d457cd6ae8a1..8f0c294f0b14 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -114,7 +114,7 @@ jobs: elif [[ "${{ github.event_name }}" != "pull_request" ]]; then check_level=1 else - labels="$(gh api repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/pulls/${{ github.event.pull_request.number }}) --jq '.labels'" + labels="$(gh api repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/pulls/${{ github.event.pull_request.number }} --jq '.labels')" if echo "$labels" | grep -q "release-ci"; then check_level=2 elif echo "$labels" | grep -q "merge-ci"; then