Skip to content

Skip copilot-requests tip for individual (non-org) repository owners#39923

Merged
dsyme merged 2 commits into
mainfrom
copilot-requests-tip-skip-individual-owners
Jun 18, 2026
Merged

Skip copilot-requests tip for individual (non-org) repository owners#39923
dsyme merged 2 commits into
mainfrom
copilot-requests-tip-skip-individual-owners

Conversation

@dsyme

@dsyme dsyme commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Skip copilot-requests tip for individual (non-org) repository owners

Summary

The copilot-requests: write permission tip advises users to enable GitHub Actions token-based Copilot inference instead of a personal access token. That feature requires centralized Copilot billing, which is only available to GitHub organizations — individual user accounts cannot use it. Previously the tip was always emitted whenever a workflow met the eligibility conditions, generating confusing noise for personal-repo owners who can never act on it.

This PR suppresses the tip whenever the repository owner is confirmed to be an individual User account via the GitHub API, while preserving the prior behaviour (tip shown) in every case where the owner type cannot be determined.


Changes

pkg/workflow/compiler_types.go

  • Added ownerTypeCache map[string]string field to the Compiler struct.
    Caches GitHub API owner-type results (e.g. "User", "Organization", "") keyed by owner login to avoid redundant API round-trips within a single compilation.

pkg/workflow/permissions_compiler_validator.go

  • Added repositoryOwnerIsIndividualUser() bool method on Compiler.
    • Parses c.repositorySlug into owner/repo components; returns false if the slug is absent or malformed.
    • Calls gh api /users/{owner} --jq .type and writes the result into ownerTypeCache.
    • Returns true only when the API confirms the type is "User".
    • Fails safe: returns false (tip shown) on any API error, authentication failure, or network issue, preserving the previous default behaviour for ambiguous cases.
  • Guarded the copilot-requests: write tip emission with !c.repositoryOwnerIsIndividualUser(), so the tip is suppressed only for confirmed individual owners.

Motivation / Design decisions

Concern Decision
Org owners must still see the tip false is returned for Organization type → tip is shown as before
Unauthenticated / air-gapped environments API failure returns false → tip shown; no regression
Repeated compilations ownerTypeCache prevents multiple API calls for the same owner within one session
Malformed or missing slug Early-return false → tip shown; no panic

The fail-safe default (false → show tip) means this change is strictly a noise-reduction improvement for individual users with zero regression risk for org users or offline environments.


Commits

SHA Message
dda145e Skip copilot-requests tip for individual (non-org) repository owners
14aaa71 Potential fix for pull request finding

Risk

Low. The change is additive: a new cached API call gates an informational tip. No permissions are altered, no compilation output changes for org-owned repos, and all error paths preserve the prior behaviour.

Generated by PR Description Updater for issue #39923 ·

The copilot-requests: write tip recommends GitHub Actions token-based
inference, which requires centralized Copilot billing only available to
organizations. Suppress the tip when the repository owner is confirmed to
be an individual User account via the GitHub API, while preserving prior
behavior (tip shown) whenever the owner type cannot be determined.
Copilot AI review requested due to automatic review settings June 17, 2026 23:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refines the permissions validation “tip” shown for Copilot workflows by suppressing the permissions.copilot-requests: write recommendation when the repository owner is confirmed (via the GitHub API) to be an individual user account, since centralized Copilot billing is org-only.

Changes:

  • Gate the Copilot “token-based inference” tip behind a new compiler check that confirms the repo owner type is not an individual User.
  • Add a per-compiler cache for owner type lookups to avoid repeated GitHub API calls during batch compilation.
Show a summary per file
File Description
pkg/workflow/permissions_compiler_validator.go Adds repositoryOwnerIsIndividualUser() and uses it to suppress the copilot-requests tip for personal repo owners.
pkg/workflow/compiler_types.go Adds an ownerTypeCache field on Compiler to memoize owner type lookups by owner login.

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: 1

Comment thread pkg/workflow/permissions_compiler_validator.go Outdated
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

✅ smoke-ci: safeoutputs CLI comment + comment-memory run (27728264206)

Generated by 🧪 Smoke CI for issue #39923 ·

@dsyme dsyme merged commit 6be6637 into main Jun 18, 2026
29 checks passed
@dsyme dsyme deleted the copilot-requests-tip-skip-individual-owners branch June 18, 2026 00:27
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.

2 participants