Skip to content

fix: preserves evaluation results for in-flight tasks during lazy cancellation #1855

fix: preserves evaluation results for in-flight tasks during lazy cancellation

fix: preserves evaluation results for in-flight tasks during lazy cancellation #1855

Workflow file for this run

name: Adds labels
on:
pull_request_target:
env:
GH_TOKEN: ${{ github.token }}
jobs:
check:
runs-on: ubuntu-latest
permissions:
pull-requests: write
timeout-minutes: 60
env:
PR_NUMBER: ${{ github.event.number }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Add labels
run: |
# Give some breathing room at the start.
sleep 30
echo "Waiting for CI pipelines to start"
result=""
# Wait for more than one pipeline to spawn.
until [[ $result -gt 1 ]]; do
result=$(
gh pr checks $PR_NUMBER \
--json "bucket" \
--jq "[.[] | select(.bucket == \"pending\")] | length"
)
sleep 15
done
# Wait for only the add labels pipeline to be remaining.
echo "Waiting while CI pipelines complete"
until [[ $result -eq 1 ]]; do
result=$(
gh pr checks $PR_NUMBER \
--json "bucket" \
--jq "[.[] | select(.bucket == \"pending\")] | length"
)
sleep 15
done
echo "Evaluating whether there were any CI failures"
result=$(
gh pr checks $PR_NUMBER \
--json "bucket" \
--jq "isempty(.[] | select(.bucket == \"fail\"))"
)
if [[ $result == "true" ]]; then
gh pr edit $PR_NUMBER --remove-label "S-awaiting-pass-CI"
else
gh pr edit $PR_NUMBER --add-label "S-awaiting-pass-CI"
fi
echo "Finished!"