mirror of
https://github.com/horizon-rust/horizon.git
synced 2026-11-07 11:06:11 -10:00
The bots move to a shared horizon-light label (8 light runners on playhorizon, from 2), and triage command, mojang republish and nightly build's answer join them. checks' verify and launcher, mod-registry, telemetry-server and the pack bench run on the desktop's isolated horizon-checks runners, forks included: main's pushes and the pull requests whose number ends in 0-2 by default (GitHub's pool keeps the others, so both work at once), every one with SELF_HOSTED_CI=all, none with light (desktop paused) or off (everything back to GitHub). Jobs with a secret or a token that can push, publish or start workflows stay on GitHub: tests/test_ci_runners.py pins it. playhorizon's job hook now also drops a checkout's .git past 4 GB: each light runner's held 6822 packs, 50 GB. Co-Authored-By: Claude Opus 5.5 <[email protected]>
32 lines
1.6 KiB
YAML
32 lines
1.6 KiB
YAML
name: cancel-on-close
|
|
# A closed or merged pull request's queued and running checks free the runners at once.
|
|
# pull_request_target so the token can cancel runs of pull requests from forks too;
|
|
# it checks out nothing and runs no code from the pull request.
|
|
on:
|
|
pull_request_target:
|
|
types: [closed]
|
|
permissions:
|
|
actions: write
|
|
jobs:
|
|
cancel:
|
|
# One of our small runners (horizon-light), out of GitHub's pool: no checkout, no code of the pull request
|
|
# (docs/ci-runners.md). SELF_HOSTED_CI=off: GitHub's runners.
|
|
runs-on: ${{ vars.SELF_HOSTED_CI != 'off' && fromJSON('["self-hosted", "linux", "horizon-light"]') || 'ubuntu-latest' }}
|
|
steps:
|
|
- name: Cancel the pull request's unfinished runs
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
REPO: ${{ github.repository }}
|
|
BRANCH: ${{ github.event.pull_request.head.ref }}
|
|
HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
|
|
run: |
|
|
# Every head the pull request had, not only its last: a run-parity label added on an older head left that
|
|
# run queued after the merge (#3104, 2026-10-29). Its branch in its own repository names its runs (another
|
|
# fork can have a branch of the same name).
|
|
for status in queued in_progress waiting pending requested; do
|
|
gh api -X GET "repos/$REPO/actions/runs" -f branch="$BRANCH" -f event=pull_request -f status="$status" \
|
|
-f per_page=100 --jq ".workflow_runs[] | select(.head_repository.full_name == \"$HEAD_REPO\") | .id"
|
|
done | sort -u | while read -r id; do
|
|
gh run cancel -R "$REPO" "$id" || true
|
|
done
|