mirror of
https://github.com/nexu-io/open-design.git
synced 2026-09-20 06:15:06 +08:00
fef0ddf88e
* ci: auto-rerun once when runner/spot cancel kills ci jobs Add rerun.atom.yml as a trusted workflow_run consumer that requests one `gh run rerun --failed` when completed pull_request/merge_group ci runs lose leaf jobs to infra cancel (shutdown signal / cancelled runner), while skipping ordinary assertion failures, stale heads, and ejected merge-queue entries. * fix(ci): grant rerun atom read scopes and refuse mixed failures Add checks/pull-requests read permissions so the helper can fingerprint infra cancels, and require every non-success leaf to be infra-classified before authorizing gh run rerun --failed. Generated-By: looper 0.11.8 (runner=fixer, agent=grok-build) * fix(ci): require open PR for live-head stale gate Stop treating a same-repo branch tip as live-PR evidence. Closed PRs can leave the source branch at the failed run SHA with no open association; query open pulls by repository-qualified head ref instead, and cover the closed-PR + unchanged tip shape in self-check. Generated-By: looper 0.11.8 (runner=fixer, agent=grok-build) * fix(ci): require infra marker for cancel rerun Bare cancelled jobs without shutdown/spot annotations are ordinary (manual cancel) and must not authorize gh run rerun --failed. Generated-By: looper 0.11.8 (runner=fixer, agent=grok-build) * fix(ci): ignore aggregate gate jobs in infra-cancel classify Validate workspace and Runtime summary fail as always() mirrors of leaf outcomes and never carry runner/spot markers. Counting them as ordinary blocked pure infra-cancel reruns whenever the workflow still reached the gate. Exclude those names from classification and cover the shape in self-check. Generated-By: looper 0.11.8 (runner=fixer, agent=grok-build) * fixer: address PR #6453 follow-up items Generated-By: looper 0.11.8 (runner=fixer, agent=grok-build) * fix(ci): refuse mixed ordinary+infra job annotations Jobs that record both a real failure annotation and a later runner shutdown marker must classify as ordinary, not pure infra-cancel, so gh run rerun --failed cannot auto-retry assertion failures. Generated-By: looper 0.11.8 (runner=fixer, agent=grok-build) * fix(ci): paginate check-run annotations before infra classify GitHub defaults annotations to 30 results; a later ordinary failure must still block gh run rerun --failed. Walk pages like paginate_jobs and cover the split with a multi-page request fixture. Generated-By: looper 0.11.8 (runner=fixer, agent=grok-build) * fix(ci): drop tracked pycache from infra-cancel helper PerishCode BLOCKING on #6453: remove the accidental CPython 3.14 bytecode under .github/scripts/__pycache__/ and ignore __pycache__/ plus *.py[cod] so local self-check/compile output stays out of git. * fix(ci): open-PR merge_group freshness; ignore warning annotations Merge-group infra-cancel retries no longer require the synthetic head to still sit in the merge queue — workflow_run completed fires after required checks already ejected it. Freshness is an open PR still associated with the run (commit→pulls or gh-readonly-queue pr-N ref). Warning-level annotations (e.g. scopes.ts full-plan fallback) no longer count as ordinary failures that suppress pure infra-cancel retry. Generated-By: looper 0.11.8 (runner=fixer, agent=grok-build) * fix(ci): match merge_group PR heads and arm rerun e2e Vitest Compare the live open PR head with the PR head SHA encoded in the merge-queue branch before authorizing infra-cancel retry, and enroll the rerun atom surfaces in scopes so PR CI runs the topology self-check. Generated-By: looper 0.11.8 (runner=fixer, agent=grok-build)
70 lines
2.5 KiB
YAML
70 lines
2.5 KiB
YAML
name: rerun.atom
|
|
|
|
# Atomic capability: when a completed `ci` run lost leaf jobs to runner/spot
|
|
# cancel, request one automatic `gh run rerun --failed`. Decision logic lives in
|
|
# `.github/scripts/rerun_infra_cancel.py` so the gate stays unit-testable and
|
|
# checkout stays on the trusted default branch only.
|
|
on:
|
|
workflow_run:
|
|
workflows: [ci]
|
|
types: [completed]
|
|
|
|
permissions:
|
|
actions: write
|
|
contents: read
|
|
# Helper reads check-run annotations (infra fingerprint) and commit→pulls
|
|
# (live PR head). With a workflow-level permissions block, unspecified scopes
|
|
# default to none — omit these and real runs hit Resource not accessible.
|
|
checks: read
|
|
pull-requests: read
|
|
|
|
concurrency:
|
|
group: rerun-${{ github.event.workflow_run.id }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
rerun_infra_cancel:
|
|
name: Rerun infra-cancelled ci jobs
|
|
# pull_request + merge_group only. Fork PR runs are allowed when the token
|
|
# can rerun them; the helper no-ops cleanly when the head is stale or the
|
|
# fingerprint does not match.
|
|
if: >-
|
|
${{
|
|
github.repository == 'nexu-io/open-design'
|
|
&& github.event.workflow_run.name == 'ci'
|
|
&& github.event.workflow_run.conclusion != 'success'
|
|
&& github.event.workflow_run.conclusion != 'skipped'
|
|
&& github.event.workflow_run.run_attempt < 2
|
|
&& (
|
|
github.event.workflow_run.event == 'pull_request'
|
|
|| github.event.workflow_run.event == 'merge_group'
|
|
)
|
|
}}
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 5
|
|
|
|
steps:
|
|
- name: Checkout trusted workflow code
|
|
uses: actions/checkout@v6.0.2
|
|
with:
|
|
repository: ${{ github.repository }}
|
|
ref: ${{ github.event.repository.default_branch }}
|
|
sparse-checkout: |
|
|
.github/scripts
|
|
sparse-checkout-cone-mode: true
|
|
|
|
- name: Self-check rerun helper
|
|
run: python3 .github/scripts/rerun_infra_cancel.py self-check
|
|
|
|
- name: Detect infra cancel and rerun failed jobs
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
REPO: ${{ github.repository }}
|
|
RUN_ID: ${{ github.event.workflow_run.id }}
|
|
RUN_EVENT: ${{ github.event.workflow_run.event }}
|
|
HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
|
|
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
|
|
ATTEMPT: ${{ github.event.workflow_run.run_attempt }}
|
|
MAX_ATTEMPT: "2"
|
|
run: python3 .github/scripts/rerun_infra_cancel.py run
|