hyperhive/.forgejo/workflows/ci.yml
atlas c9c59c2a1d hive-forge: ci-rerun dispatches a fresh run via workflow-dispatch API
The previous implementation POSTed Forgejo's run-page rerun web route,
which is CSRF-gated and answers a bare token POST with 404 — so the verb
never actually re-ran anything against the agent token.

Rework it to dispatch a fresh run of the workflow via the
GitHub-compatible workflow-dispatch API
(POST /repos/<o>/<r>/actions/workflows/<workflow>/dispatches {"ref":<branch>}),
which accepts a plain agent token (verified end-to-end on Forgejo 15.0.3).
A dispatched run is equivalent to the old empty-commit retrigger, minus
the commit.

The branch is resolved from exactly one of --pr (the PR head branch),
--run (branch + workflow looked up from that run in the Actions runs
list), or --branch (directly); --workflow picks the workflow file for
--pr/--branch (default ci.yml). Dispatch re-runs the whole workflow, so
the old --job single-job variant is dropped.

Also add workflow_dispatch to .forgejo/workflows/ci.yml for explicitness
(Forgejo 15.0.3 dispatches the pull_request workflow without it, but the
trigger makes the API path intent-clear and cross-version robust), remove
the now-unused Client::post_web_no_content, and update docs/tools/forge.md.
2026-06-23 14:53:11 +02:00

42 lines
1.5 KiB
YAML

name: CI
on:
pull_request:
branches: ["**"]
# Lets `hive-forge ci-rerun` re-trigger CI via the workflow-dispatch API
# without an empty commit. No effect on the PR-triggered runs above.
workflow_dispatch:
jobs:
check:
name: nix flake check
runs-on: [hive-ci]
# Bound the job so a wedged build fails in minutes instead of
# hanging until the runner's 3h cap (or, when the runner itself
# deadlocks, never). 30 min is well above a cold-cache rebuild
# (~15 min observed) and well under the 3h hard cap — tune if a
# legit cold build ever trips it.
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: check
# Runs all flake checks: formatting (treefmt+rustfmt), cargo test,
# cargo clippy, and module evaluation. No --no-build: the checks
# derivations are the canonical source of truth.
run: nix flake check
tracker-tags:
name: tracker-tag lint
runs-on: [hive-ci]
# Pure git+grep — seconds normally; a few minutes is already a hang.
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- name: lint
# Flags hash-number tracker tags in source (hive convention is
# prose, not tags — /knowledge/hive-rules.md). Runs as its own
# job, kept out of the required checks while the legacy backlog
# is cleaned up: a hit fails this check (red) without blocking
# merge. Promote to a required check once the tree is clean.
# See scripts/check-issue-refs.sh.
run: sh scripts/check-issue-refs.sh