ci: guard sample-catalog.json against manual edits#485
Closed
Yimin-Jin wants to merge 1 commit into
Closed
Conversation
Add a pull_request check that fails any PR modifying samples/hosted-agent/sample-catalog.json unless it originates from a Sync Sample Catalog branch (ci/sync-sample-catalog-*). The catalog is a generated artifact and must only be updated by CI. Enforcement requires marking guard-catalog as a required status check and disallowing direct pushes on the protected branch.
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
Adds a CI guard so
samples/hosted-agent/sample-catalog.jsoncan only be updated by the Sync Sample Catalog workflow — never by a manual / local commit.How it works
guard-sample-catalog.ymlruns on every PR. If the PR changessample-catalog.jsonand its head branch is notci/sync-sample-catalog-*(the branch the sync workflow opens PRs from), the check fails with a message telling the author to revert and let CI regenerate it. PRs that don't touch the file pass immediately.Required follow-up to make it ENFORCE
A
pull_requestcheck only reports by default. To make it actually block:guard-catalogas a required status check for this branch.pull_requestguard cannot catch a direct push.Scope
This PR adds the workflow only; it does not touch
sample-catalog.json. Apull_requestworkflow guards PRs into the branch it lives on, so identical PRs are opened fortemplate/dev,template/stable, andtemplate/pre-release.