Fix false post-create repo validation in cross-repo create_pull_request workflows#36250
Merged
Merged
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix validation issue for cross-repo pull requests
Fix false post-create repo validation in cross-repo Jun 1, 2026
create_pull_request workflows
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a contradictory failure mode where cross-repo create_pull_request runs could open a PR successfully but later fail context validation with ERR_VALIDATION because the post-creation checkAllowedRepo only consulted the global GH_AW_ALLOWED_REPOS allowlist and ignored handler-level allowed_repos.
Changes:
- In
checkAllowedRepo, when the global allowlist is empty, parseGH_AW_SAFE_OUTPUTS_HANDLER_CONFIGand aggregate each handler'sallowed_reposinto the effective allowlist before validating the target repo. - Wrap the JSON parse / shape checks defensively so malformed config silently falls back to the (empty) global allowlist.
- Add a regression test asserting
workflow_dispatchwith no global allowlist but a matchingcreate_pull_request.allowed_reposresolves successfully.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/invocation_context_helpers.cjs | Fallback to handler-config allowed_repos aggregation when global allowlist is empty. |
| actions/setup/js/invocation_context_helpers.test.cjs | New test covering the handler-allowlist fallback path. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
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.
Cross-repo
create_pull_requestruns could successfully open a PR and then fail in a later validation path withERR_VALIDATION(“repo not in allowed-repos”), because that second check only considered a global allowlist and ignored handler-levelallowed_repos. This produced contradictory outcomes and marked successful runs as failed.Invocation-context allowlist fallback
checkAllowedRepoinactions/setup/js/invocation_context_helpers.cjs.GH_AW_ALLOWED_REPOSis empty, validation now falls back toGH_AW_SAFE_OUTPUTS_HANDLER_CONFIGand aggregates handlerallowed_reposentries before validatingworkflow_dispatchtarget_repo.create_pull_request.Regression coverage for the failing path
actions/setup/js/invocation_context_helpers.test.cjsforworkflow_dispatchwith:create_pull_request.allowed_reposcontaining target repo,target_reposet to that repo.