[new-plugin] btc-adaptive-hyperliquid v1.0.0 #174
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Cancel stale Phase 1-3 workflow runs when a PR is closed or merged. | |
| # This frees up GitHub Actions runner slots for Phase 4 publishing. | |
| name: "Cleanup: Cancel PR workflows" | |
| on: | |
| pull_request_target: | |
| types: [closed] | |
| jobs: | |
| cancel: | |
| runs-on: ubuntu-latest | |
| permissions: {} | |
| steps: | |
| - name: Cancel Phase 1-3 runs for this PR | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| PR_NUM="$PR_NUMBER" | |
| HEAD_SHA="$PR_HEAD_SHA" | |
| echo "PR #${PR_NUM} closed. Cancelling stale Phase 1-3 runs..." | |
| CANCELLED=0 | |
| gh api "repos/${{ github.repository }}/actions/runs?head_sha=${HEAD_SHA}&per_page=100" \ | |
| --jq '.workflow_runs[] | select(.status != "completed") | select(.name | test("Phase [1-3]|Structure|Build Verification|AI Code")) | .id' \ | |
| | while read run_id; do | |
| gh api "repos/${{ github.repository }}/actions/runs/$run_id/cancel" --method POST 2>/dev/null && \ | |
| echo " Cancelled run $run_id" || true | |
| done | |
| echo "Done." |