Skip to content

ci: guard sample-catalog.json against manual edits#485

Closed
Yimin-Jin wants to merge 1 commit into
template/pre-releasefrom
yimin/guard-catalog-pre-release
Closed

ci: guard sample-catalog.json against manual edits#485
Yimin-Jin wants to merge 1 commit into
template/pre-releasefrom
yimin/guard-catalog-pre-release

Conversation

@Yimin-Jin

Copy link
Copy Markdown
Collaborator

Summary

Adds a CI guard so samples/hosted-agent/sample-catalog.json can only be updated by the Sync Sample Catalog workflow — never by a manual / local commit.

How it works

guard-sample-catalog.yml runs on every PR. If the PR changes sample-catalog.json and its head branch is not ci/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_request check only reports by default. To make it actually block:

  1. Mark guard-catalog as a required status check for this branch.
  2. Disallow direct pushes to this branch (PRs only) — a pull_request guard cannot catch a direct push.

Scope

This PR adds the workflow only; it does not touch sample-catalog.json. A pull_request workflow guards PRs into the branch it lives on, so identical PRs are opened for template/dev, template/stable, and template/pre-release.

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.
@Yimin-Jin Yimin-Jin requested a review from huimiu as a code owner June 23, 2026 09:34
@Yimin-Jin Yimin-Jin closed this Jun 23, 2026
@Yimin-Jin Yimin-Jin deleted the yimin/guard-catalog-pre-release branch June 23, 2026 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant