Repository navigation
Conversation
The workflow-health rule lived in inline bash with no test, so dropping the branch scope was invisible until STATE.md showed a false failing count. Move the rule into scripts/workflow-health.mjs: the gh query is always main-scoped, conclusions are classified as failing/pending/unknown, errors become unknown instead of failures, and GITHUB_OUTPUT is written for the workflow. Ten node tests pin the behaviour (including the --branch main argv) and run in ci-validate-gates.sh via npm run test:scripts.
Contributor
|
This PR changes paths that must run the real Fork PRs from first-time contributors start with those workflows waiting for approval. A maintainer needs to open the Checks tab and click Approve and run workflows. Until that happens, branch protection will show the PR as blocked even after a review. Content-only PRs ( — loop-engineering fork-pr-gate |
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extract the daily-triage workflow-health rule into
scripts/workflow-health.mjsand pin it with node tests, so the main-branch scope can't silently regress again.Related issue
Relates to the
**2** dogfood workflow(s) failingitem that sat inSTATE.mdsince 2026-10-02: the rule was inline bash, untested, and the bug was a missing branch filter.Context
The check used
gh run list --workflow=<wf>.yml --limit 1with no branch filter. Automated branches are pushed withGITHUB_TOKEN, and their PR runs end as startup failures (jobs: [], "workflow file issue"), so those runs were counted asvalidate-patterns/auditfailures whilemainwas green. The same gates already run inside the automation before the PR opens, so a bot PR's own run carries no signal.Branch scoping alone is a one-line fix (separate PR). This PR makes the rule testable so the next edit can't quietly drop it.
Changes
Tool / CLI change under
tools/— n/a;scripts/onlyscripts/workflow-health.mjsargsFor(workflow, branch = 'main')always includes--branch mainand--limit 1.evaluate(rows)classifiesfailure/timed_out/startup_failureas failing,queued/in_progressas pending, missing or unreadable asunknown(never a failure).collect({ exec })is injectable, so tests pin the gh argv without touching the network.failing=N, and appendsfailing=to$GITHUB_OUTPUT.scripts/workflow-health.test.mjs: 10 tests, including the regression pin on--branch mainand "gh errors become unknown, never failures".daily-triage.yml: the step becomesnode scripts/workflow-health.mjs(sameGH_TOKEN, samefailingoutput).ci-validate-gates.sh+package.json(npm run test:scripts): the new tests run in the validate gate.Checklist (from CONTRIBUTING)
STATE.md*examples use.examplesuffix (n/a)docs/safety.md(n/a)tools/<pkg>: n/aTesting / Dogfood
node --test scripts/workflow-health.test.mjs→ 10 pass, 0 failnode scripts/workflow-health.mjsagainst the live repo →validate-patterns: success,audit: success,failing=0node --test scripts/workflow-health.test.mjs scripts/github-triage.test.mjs scripts/append-run-log.test.mjs scripts/sync-untrusted-input.test.mjs→ 46 pass, 0 failnpm run validate:registry→ Registry valid: 8 patternsyaml.safe_load) with the new stepOpened from a fork (
thlwt:fix/workflow-health-script) because this account has no write access to the upstream repo.