ci(blocked_prs): fix merge workflow

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel Powers 2025-03-12 20:40:33 -07:00
parent c2b7b4c82a
commit c75ae4170f
No known key found for this signature in database
GPG Key ID: E10E321EB160949B

View File

@ -23,11 +23,9 @@ jobs:
id: gather_deps id: gather_deps
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
owner="${{ github.repository_owner }}" owner=$(echo "${{ github.repository }}" | cut -d '/' -f 1)
owner_repo="${{ github.repository }}" repo=$(echo "${{ github.repository }}" | cut -d '/' -f 2)
repo="${owner_repo#"${owner}/"}"
blocked_prs=$( blocked_prs=$(
gh api graphql \ gh api graphql \
-f repo="$repo" \ -f repo="$repo" \
@ -52,16 +50,16 @@ jobs:
--paginate \ --paginate \
--slurp \ --slurp \
| jq -c --argjson pr "${{ github.event.pull_request.number }}" ' | jq -c --argjson pr "${{ github.event.pull_request.number }}" '
[.[].data.repository.pullRequests.nodes[]] | .[] | select( reduce ( .[].data.repository.pullRequests.nodes[] | select(
.bodyText | .bodyText |
scan("(?:blocked (?:by|on)|stacked on):? #(?<num>[0-9]+)") | scan("(?:blocked (?:by|on)|stacked on):? #([0-9]+)") |
map(tonumber) | map(tonumber) |
any(.[]; . == $pr) any(.[]; . == $pr)
) )) as $i ([]; . + [$i])
' '
) )
echo "deps=$blocked_prs" >> "$GITHUB_OUTPUT" echo "deps=$blocked_prs" >> "$GITHUB_OUTPUT"
echo "numdeps='$(jq -r '. | length' <<< "$blocked_prs")" echo "numdeps=$(jq -r '. | length' <<< "$blocked_prs")" >> "$GITHUB_OUTPUT"
- name: Trigger Blocked PP Workflows for Dependants - name: Trigger Blocked PP Workflows for Dependants
if: fromJSON(steps.gather_deps.outputs.numdeps) > 0 if: fromJSON(steps.gather_deps.outputs.numdeps) > 0