Guard the generated Cookbook pages from hand edits - #886
Open
jpshackelford wants to merge 1 commit into
Open
jpshackelford wants to merge 1 commit into
jpshackelford wants to merge 1 commit into
Conversation
Fails PRs that edit cookbook/ outside the enterprise-cookbook sync branches, excludes cookbook/ from sync_code_blocks.py, and documents the flow in AGENTS.md. Co-authored-by: openhands <openhands@all-hands.dev>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
jpshackelford
marked this pull request as ready for review
October 3, 2026 18:38
enyst
approved these changes
Oct 4, 2026
enyst
left a comment
Member
There was a problem hiding this comment.
I'm an AI agent based on Opus 5.5, helping Engel Nyst (@enyst) with project work.
I read the guard and the sync_code_blocks.py exclusion, and both do what the description says. The allowed branch names match enterprise-cookbook's workflows (SYNC_BRANCH: cookbook-sync, cookbook-preview/pr-N). Fork PRs fail, head_ref is passed through env, and the workflow only has read permissions.
Two non-blocking notes:
- The guard only watches
cookbook/**, so a hand edit to the Cookbook tab indocs.jsonstill passes. AGENTS.md covers this, so leaving it to reviewers seems fine. - If this becomes a required check, the
pathsfilter will leave PRs that don't touchcookbook/waiting for a check that never runs. Either keep it optional, or drop the filter and check the changed files inside the step.
This branch was successfully deployed
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 of changes
The Cookbook tab is now generated from example READMEs in OpenHands/enterprise-cookbook (OpenHands/enterprise-cookbook#7). That repository opens a draft
cookbook-preview/pr-<N>PR here for each of its PRs to get a Mintlify preview, and a singlecookbook-syncPR to publish merged changes; the first is #884. This PR makes the docs repository respect that ownership:cookbook-generated.ymlfails any PR that touchescookbook/from a branch other than those two, because a hand edit would be overwritten by the next sync. The error links to the authoring guide in enterprise-cookbook.sync_code_blocks.pyskipscookbook/. That script replaces any.pyor.yamlcode block whose path exists in software-agent-sdk; cookbook code-block paths are relative to each example, so an accidental path match would overwrite a generated page with an unrelated SDK file.AGENTS.mddocuments the flow alongside the other cross-repo syncs.Validation: a new test for
find_mdx_filesfails without the exclusion and passes with it (pytest tests/test_sync_code_blocks.py: 18 passed). The guard itself runs only on PRs that touchcookbook/, so it doesn't run on this one; it should pass on #884 and fail on #604.This PR was drafted by an AI agent on behalf of the user.
@jpshackelford can click here to continue refining the PR