Repository navigation
ci: AGENTS.md and the pull-request gates - #14
Open
thesprockee wants to merge 2 commits into
Open
thesprockee wants to merge 2 commits into
thesprockee wants to merge 2 commits into
Conversation
AGENTS.md sets the repo's rules (logging, conventional commits, the credit rule, review, workflows, entries). scripts/gates.py enforces what a machine can: a conventional PR title and commit headers, well-formed Co-Authored-By trailers, a current approval from someone other than the author on anything but docs, and every action pinned by commit. Each gate prints a JSON record and fails loudly; the existing submission workflow's actions are pinned. The header check is adapted from nevr-runtime's tools/check_pr_title.py. Closes #11 Co-Authored-By: Andrew Bates <a@sprock.io>
The gates ran as `gates.py ... | tee`, and GitHub's default bash has no pipefail, so the job took tee's exit code: the review gate printed ok:false and the check was green. Run every step with `shell: bash` (-eo pipefail), and test that the workflow says so. Refs #11 Co-Authored-By: Andrew Bates <a@sprock.io>
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.
PR 2 of 3 of Spritz's order (after #8). Closes #11.
What
AGENTS.md: what the repo is, logging, conventional commits, the credit rule, review, issues/branches/PRs, workflows (pins, trust boundary), entries, commands, never.scripts/gates.pywith four gates, each printing one JSON record (event,at,ok,errors, what was checked) and exiting 0/1, or 2 with acannot_runrecord when it can't run:title: the PR title is a Conventional Commits header (adapted from nevr-runtime'stools/check_pr_title.py).commits: every commit in base..head is conventional, and eachCo-Authored-ByisName <email>with a GitHub noreply address ora@sprock.io/agents@sprock.io(the credit rule).review: a PR that changes anything but README/docs has a current approval (on the head commit) from an owner/member/collaborator other than its author, and no open change request (the design's review gate).pins: everyuses:is pinned by a 40-hex commit.check-submission.yml's five actions are pinned in this PR..github/workflows/gates.yml: runs them onpull_request(andreviewalso onpull_request_review), read-only token, no secrets, records kept 90 days as artifacts.tests/test_gates.py: 24 tests, a passing and a failing case per gate.The history before this is free text ("Form: ..."); the gates only look at new PRs.
Not in this PR
The gates are advisory until the ruleset below exists.
AGENTS.mdmentions the commands for the validator from #8, so merge #8 first.Note for Mia: making the gates required (owner setting)
The gates only report until you add a ruleset; there is none today. So
reviewstays red on a PR until someone other than its author approves, and nothing stops a merge meanwhile. To make them bind, in Settings → Rules → Rulesets → New branch ruleset, targetmain(default branch):title,commits,review,pins,tests. Addvalidateonce feat: entry schema, validator and CI check for listed mods #8 is merged andpackage-layout-testsonce feat: the submission check reads the plugin-release layout #17 is, if you want those required too.Owners can be left as bypass actors if you want to merge your own PRs; the review gate is red for a PR whose only approver is its author, whatever the ruleset says.
Commands run
Mutants (one line changed at a time, tests run, file restored from a saved copy):
Real records from this branch (and the review gate against the open #8, which has no approval yet):
The
reviewjob on this PR is expected to be red until someone other than the author approves it.Found and fixed on this PR (0770bf9)
The first push ran the gates as
gates.py ... | tee; GitHub's default bash has nopipefail, soreviewprinted"ok": falseand the check was green (run 40322956555). Fixed withdefaults: run: shell: bash;test_a_piped_gate_still_fails_the_jobreads the workflow for it (mutant: remove the default -> that test fails; 24 tests OK restored). On the new tipreviewis red as intended (run 40323161570);title,commits,pins,testsand CodeQL pass.Co-Authored-By: Andrew Bates a@sprock.io