fix: default github.repos to all when omitted from guard policy#21718
Merged
fix: default github.repos to all when omitted from guard policy#21718
github.repos to all when omitted from guard policy#21718Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix invalid guard policy requirement for single repo
fix: default Mar 19, 2026
github.repos to all when omitted from guard policy
Contributor
|
@copilot add workflow integration tests in pkg/cli/workflows |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Author
Added in b37ea93:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes GitHub guard policy validation so workflows that specify only tools.github.min-integrity no longer fail validation; tools.github.repos is treated as "all" by default.
Changes:
- Default
tools.github.reposto"all"when omitted butmin-integrityis present. - Update unit tests and add CLI compilation tests/fixtures covering min-integrity-only and other guard policy scenarios.
- Update scratchpad documentation to reflect the new defaulting behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| scratchpad/guard-policies-specification.md | Updates spec text/examples to document repos defaulting behavior. |
| scratchpad/dev.md | Updates developer docs to match the new guard policy requirements/defaults. |
| pkg/workflow/tools_validation.go | Implements the new defaulting behavior in guard policy validation. |
| pkg/workflow/tools_validation_test.go | Updates validation tests to expect success when repos is omitted. |
| pkg/cli/workflows/test-guard-policy-min-integrity-only.md | Adds a workflow fixture demonstrating min-integrity without repos. |
| pkg/cli/compile_guard_policy_test.go | Adds compilation-level tests for multiple guard policy configurations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| toolsValidationLog.Printf("Missing repos in guard policy for workflow: %s", workflowName) | ||
| return errors.New("invalid guard policy: 'github.repos' is required. Use 'all', 'public', or an array of repository patterns (e.g., ['owner/repo', 'owner/*'])") | ||
| toolsValidationLog.Printf("Defaulting repos to 'all' in guard policy for workflow: %s", workflowName) | ||
| github.Repos = "all" |
Comment on lines
+304
to
311
| name: "missing repos field defaults to all", | ||
| toolsMap: map[string]any{ | ||
| "github": map[string]any{ | ||
| "min-integrity": "unapproved", | ||
| }, | ||
| }, | ||
| shouldError: true, | ||
| errorMsg: "'github.repos' is required", | ||
| shouldError: false, | ||
| }, |
| require.NoError(t, err, "Failed to write workflow file") | ||
|
|
||
| compiler := workflow.NewCompiler() | ||
| err = CompileWorkflowWithValidation(compiler, workflowPath, false, false, false, false, false, false) |
This was referenced Mar 19, 2026
github-actions bot
added a commit
that referenced
this pull request
Mar 19, 2026
- Add inline JavaScript script handlers (`safe-outputs.scripts`) section to custom-safe-outputs.md, documenting the new in-process handler feature added in #21582 - Fix github-tools.md guard policy description: repos defaults to "all" when omitted, only min-integrity is required (#21718) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced Mar 19, 2026
3 tasks
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.
Specifying only
min-integrityundertools.githubwithout areposfield incorrectly raised a hard validation error, despiterepos: allbeing the obvious intent when no restriction is needed.Changes
tools_validation.go: Whenreposis absent butmin-integrityis set, silently defaultreposto"all"instead of returning an errortools_validation_test.go: Updated test case from "should error" to "should succeed with defaulted repos"scratchpad/: Updated documentation to reflect thatmin-integrityis the only required field;reposdefaults to"all"pkg/cli/workflows/test-guard-policy-min-integrity-only.md: Added workflow fixture demonstratingmin-integritywithoutreposcompiles cleanlypkg/cli/compile_guard_policy_test.go: Added unit tests covering all guard policy compilation scenarios (min-integrity-only, explicit repos=all, repos=public, repos array, and repos-only-without-min-integrity)Before / After
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.