fix: restore permission-discussions in GitHub App token fields#25709
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 <[email protected]>
|
@lpcox the actions/create... needs to fix the warning |
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
|
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 |
|
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