Skip to content

Suppress wildcard fetch warning for public repos#20955

Merged
dsyme merged 7 commits into
mainfrom
copilot/fix-warning-in-public-repos
Mar 14, 2026
Merged

Suppress wildcard fetch warning for public repos#20955
dsyme merged 7 commits into
mainfrom
copilot/fix-warning-in-public-repos

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 14, 2026

The push-to-pull-request-branch: target: "*" wildcard fetch warning is irrelevant for public repos — all PR branches are always accessible without special fetch configuration in OSS repos.

Changes

  • computeIsPublicRepo() — new method on *Compiler in push_to_pull_request_branch_validation.go that queries gh api /repos/{slug} --jq .visibility on demand, returning true only when the API confirms the repo is public; validates owner/repo slug format and returns false on any failure
  • validatePushToPullRequestBranchWarnings — gates the wildcard fetch warning on !c.computeIsPublicRepo(); visibility is resolved lazily, only when the warning is about to fire

Safe-by-default: if visibility cannot be determined (no auth, network error, missing or malformed slug), the warning is still shown.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI and others added 2 commits March 14, 2026 15:26
Co-authored-by: dsyme <7204669+dsyme@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 14, 2026 17:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds repository-visibility awareness to the workflow compiler so the push-to-pull-request-branch wildcard-fetch warning is suppressed for public repositories, and wires up CLI-side visibility detection.

Changes:

  • Introduces Compiler.isPublicRepo plus WithPublicRepo/SetPublicRepo to record repo visibility.
  • Suppresses the target: "*" wildcard-fetch warning when the repo is known to be public.
  • CLI now attempts to detect repo visibility via gh api and passes it into the compiler; includes a new unit test for the warning behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
pkg/workflow/push_to_pull_request_branch_warning_test.go Adds coverage to ensure wildcard-fetch warning is suppressed when repo visibility is public.
pkg/workflow/push_to_pull_request_branch_validation.go Gates wildcard-fetch warning on repo visibility (public repos suppress).
pkg/workflow/compiler_types.go Adds repo visibility field and configuration hooks to the compiler.
pkg/cli/compile_compiler_setup.go Detects repo visibility via gh api during compiler setup and passes it into the compiler.

💡 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.

Comment thread pkg/cli/compile_compiler_setup.go Outdated
Comment thread pkg/cli/compile_compiler_setup.go Outdated
Comment thread pkg/cli/compile_compiler_setup.go Outdated
Comment thread pkg/workflow/push_to_pull_request_branch_warning_test.go Outdated
dsyme and others added 2 commits March 14, 2026 19:41
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment thread pkg/workflow/push_to_pull_request_branch_validation.go Outdated
@dsyme dsyme marked this pull request as draft March 14, 2026 19:45
…thod

Co-authored-by: dsyme <7204669+dsyme@users.noreply.github.com>
Copilot AI requested a review from dsyme March 14, 2026 19:55
@dsyme dsyme marked this pull request as ready for review March 14, 2026 21:03
@dsyme dsyme merged commit 8d431ff into main Mar 14, 2026
52 checks passed
@dsyme dsyme deleted the copilot/fix-warning-in-public-repos branch March 14, 2026 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warning about ⚠ push-to-pull-request-branch: target: "*" requires that all PR branches are fetched at checkout. should not be shown in public repos

3 participants