fix: restore permission-discussions in GitHub App token fields#25709
Merged
fix: restore permission-discussions in GitHub App token fields#25709
Conversation
PR #25508 removed permission-discussions from convertPermissionsToAppTokenFields() based on two incorrect assumptions: 1. That unsupported inputs are silently ignored by actions/create-github-app-token. In reality, the action reads ALL INPUT_PERMISSION-* env vars from process.env (see lib/get-permissions-from-inputs.js), not just declared inputs. 2. That GitHub App tokens inherit full installation permissions by default. This is only true when ZERO permission-* inputs are set. When any permission-* field is specified (which the compiler always does), the token is scoped to only those permissions — omitting permission-discussions excludes discussions. This caused create-discussion safe-outputs to fail with permissions errors and fall back to issue creation when using GitHub App authentication. Closes #25704 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Collaborator
|
@lpcox the actions/create... needs to fix the warning |
Collaborator
Contributor
There was a problem hiding this comment.
Pull request overview
Restores permission-discussions generation for GitHub App token minting so safe-outputs that create discussions request the correct scoped permissions again (regression from PR #25508).
Changes:
- Re-add
PermissionDiscussions→permission-discussionsmapping inconvertPermissionsToAppTokenFields(), with updated rationale comment. - Update safe-outputs workflow compilation test to assert
permission-discussions: writeis emitted forcreate-discussion. - Update GitHub App permissions mapping validation test to expect
permission-discussionsto be present.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/safe_outputs_app_config.go | Restores discussions permission mapping for GitHub App token with: permission-* fields. |
| pkg/workflow/safe_outputs_app_test.go | Updates test expectations to require permission-discussions: write in the minted-token step. |
| pkg/workflow/github_app_permissions_validation_test.go | Updates mapping validation test to expect permission-discussions output. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 0
pelikhan
approved these changes
Apr 10, 2026
salmanmkc
approved these changes
Apr 10, 2026
This was referenced Apr 10, 2026
Collaborator
|
this should fix it some override seems like was a snapshot and is now outdated, updated this too, this is upstream and if this was right then the above pr wouldn't be needed either octokit/openapi#529 this also seems to fix it http://github.com/actions/create-github-app-token/pull/358l |
|
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
Reverts the regression introduced by PR #25508, which removed
permission-discussionsfrom theconvertPermissionsToAppTokenFields()function.Root Cause
PR #25508 was based on two incorrect assumptions about
actions/create-github-app-token:1. "Unsupported inputs are silently ignored"
Wrong. The action reads all
INPUT_PERMISSION-*environment variables fromprocess.env, not just declared inputs (source):GitHub Actions sets
INPUT_PERMISSION-DISCUSSIONSfor anywith: permission-discussions:field, so the value IS forwarded to the GitHub API despite the "Unexpected input" warning in the logs.2. "Tokens inherit full installation permissions by default"
Only partially true. This is only the case when zero
permission-*inputs are specified. When anypermission-*field is set (which the compiler always does —permission-contents,permission-issues, etc.), the token is explicitly scoped to only those permissions:Omitting
permission-discussionscauses the minted token to lack discussions access even when the GitHub App installation has that permission.Impact
create-discussionsafe-outputs fail with permissions errorsfallback-to-issue: true)Changes
safe_outputs_app_config.go: Restorepermission-discussionsmapping with corrected comment explaining the actual behaviorsafe_outputs_app_test.go: Update test to assertpermission-discussions: writeIS presentgithub_app_permissions_validation_test.go: Update test to verify discussions permission IS mappedTesting
TestSafeOutputsAppTokenDiscussionsPermission,TestConvertPermissionsToAppTokenFields_GitHubAppOnly)Closes #25704