Repository navigation
feat: pr-changes.yml and the required-gate action for PR-only CI (Phase 1) - #20
Merged
Merged
Conversation
A repository's PR workflow (pr.yml) runs its heavy validation once per pull request revision instead of on the branch push, the pull request and the merge to main. Two shared pieces: - pr-changes.yml classifies the files the pull request's merge commit changes against its first parent: documentation only, or full. Unknown means full: deletions, renames, symlinks, agent instructions, fixtures, dot directories, code-paths, non-PR events and unverifiable checkouts. - actions/required-gate is the single required check, "OT Fabric Required Checks". It fails on any failed, cancelled, unexpectedly skipped, missing or malformed result, on an undeclared job, and without a classification. Selftest: the extracted classifier on 30 synthetic pull requests, the gate on 28 cases and all 768 result combinations, and both on real GitHub job results. Existing workflows are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Shared pieces for Phase 1 of PR-only CI: heavy validation runs once per pull request revision, not again on the feature-branch push or the merge to
main. Releases keep testing in full (unchanged)..github/workflows/pr-changes.ymlfull: "false") or full ("true")actions/required-gate/action.yml,gate.pyOT Fabric Required Checks.github/workflows/selftest.ymlscripts/selftest/pr-changes.sh,required-gate.sh.github/workflows/README.md,actions/README.md,README.md,AGENTS.mdgo-ci.yml,docs-check.ymland the release workflows are unchanged: same inputs, defaults, job names and permissions. Existing callers see no difference.Behaviour
Classification (
pr-changes.yml) compares the PR's merge commit with its first parent, which is exactly the tree the heavy jobs check out. That means no API pagination, no 3000-file limit and nopull-requestsscope. A file counts as documentation only if it is an added or modified regular*.mdfile outside dot directories,testdata/andvendor/, is notAGENTS.md/CLAUDE.md/GEMINI.md, and does not match the caller'scode-paths. Anything else givesfull: "true", including deletions, renames, symlinks, executable files, non-PR events, a HEAD that is not the PR's merge commit, and git errors. The step never fails on a classification problem; it falls back to full and gives the reason. File names are sanitized, so a name containing a newline cannot inject intoGITHUB_OUTPUT.The gate (
required-gate) fails on:needs;needswith no expectation;On a documentation-only PR the
required-for-codejobs must be skipped (or succeed). The gate job sits in the caller'spr.ymlwithif: always(), so it reports as exactlyOT Fabric Required Checksand is never skipped. That matters because a skipped job counts as passed for a required check.Checks
scripts/selftest/pr-changes.sh: 30 cases pass locally (macOS)scripts/selftest/required-gate.sh: 28 cases plus all 768 combinations of (changes result × classification × docs × ci × interop) pass locally. None passes unless every expected result is there.policy.sh,release-notes.sh,go-version.shpass locally;docs-check.shnot run locally (needs docsync), runs in Selftestotfabric-policy check(engineering @ v1.5.2 checkout): compliant, 0 must/should failuresRelease
Additive, so a minor release: v3.7.0. Tagging is the maintainer's call. The pilots must move from the commit SHA to
@v3.7.0before they merge.Limits
pull_requestworkflows run the PR's own copy ofpr.yml, so an author with write access can change the gate in their PR. That is true of every workflow-based required check. Review workflow changes (CODEOWNERS on.github/workflows/), or use a ruleset that requires workflows from this repository.maingets no run until its next push or a close/reopen.editedis deliberately not a trigger, because it would rerun everything on a title edit.🤖 Generated with Claude Code