ci(rulesets): manage rulesets as code and require the existing checks - #27
Merged
Conversation
The other four repositories keep their rulesets in .github/rulesets/*.json with an apply.sh, so a rule change is a reviewable diff. This one had no such directory: its rules existed only live, with nothing in git to review, nothing to reapply after an accidental UI edit, and no record of what the rules were beforehand. Both files are faithful exports of the current live rulesets and apply as no-ops. apply.sh is the deployments copy with REPO retargeted.
main had zero required status checks, so a pull request could merge with every scan and signature job red provided it carried one approving review. This repository holds the reusable workflows the other four call by @main, so its gates protect all of them. Requires only the four checks that report unconditionally. Trivy is excluded deliberately: it is published by the code-scanning app from a SARIF upload rather than by the workflow, so it can simply not appear, and a required check that never appears blocks the branch permanently.
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.
What
Adds
.github/rulesets/— exports of both live rulesets plus theapply.shthe other four repositories use — and requires the four status checks that already run on every pull request.Why
This was the last of the five repositories keeping its branch rules only live. The other four keep them as reviewable JSON, so a rule change shows up in a diff. Here there was nothing in git to review, nothing to reapply after an accidental UI edit, and no record of the previous state.
It is also not low-stakes. This repository holds the reusable workflows every other repository calls by
@main—security-scan.yml,verify-pr-signatures.yml, the release workflows — plus the org-widegitleaks.toml. Its gates protect all five repos, andmainhad zero required checks: any pull request could merge with every scan and signature job red as long as it carried one approving review.Commits
apply.sh. No behaviour change; both apply as no-ops.required_status_checkstoBaseline.Split so the snapshot can be reviewed as a snapshot rather than read as part of the change.
Which checks, and why only these
All four are published by the
github-actionsapp (integration_id: 15368), pinned so a same-named check from another app cannot satisfy the rule.Trivyis deliberately excluded. It is published by the code-scanning app from a SARIF upload rather than by the workflow, so it can simply not appear — and a required check that never appears blocks the branch permanently with nothing red to fix.Each context was traced to its workflow before being required.
security-scan-self.ymlandverify-pr-signatures-self.ymlboth trigger on a barepull_requestwith nopaths:filter. Two of the underlying jobs —binariesandsignatures— do carryif: github.event_name == 'pull_request', which is safe: a guard towardpull_requestalways fires when required checks are evaluated. The fatal pattern is the inverse (== 'push'), which reportsskippingon a pull request and would deadlockmain.strict_required_status_checks_policyisfalse, matching platform, infrastructure and deployments. With it on, every merge tomaininvalidates the checks on every other open pull request.Verification
Export round-trips against the existing rulesets rather than recreating them:
branch-naming-convention.jsonis byte-identical to live after normalisationbaseline.jsondiffers from live only inside.rules, by exactly the addedrequired_status_checksapply.shdiffers from the deployments copy only inREPO(plus a corrected re-export hint)Not included
required_signatures. Not added, deliberately. It would be inert here for the same reason it is inert elsewhere in the org: rebase-merge rebuilds every commit server-side and signs none of them, so the rule cannot enforce what it claims. Adding an enforcement that cannot enforce is worse than its absence, because it reads as covered.After merge
apply.shmust be run by hand — there is no drift job, so merging this alone changes nothing live.