Skip to content

Problem using GitHub Apps to auth writes to discussions #19380

Description

@justinhuangai

What happens

When a workflow uses GitHub App tokens with discussions: write permission, gh aw compile emits permission-discussions: write as an input to actions/create-github-app-token. The action rejects it:

Warning: Unexpected input(s) 'permission-discussions', valid inputs are ['app-id', 'private-key', ...]

The warning is harmless at runtime (the input is silently ignored), but it indicates a code path that generates invalid configuration.

Originally reported in #18921. Scout analysis (triggered by @pelikhan) confirmed this is not an upstream bug — it is a gh-aw mapping issue.

What should happen

PermissionDiscussions should not be mapped to an actions/create-github-app-token input. The GitHub REST API for creating installation access tokens does not support discussions as a permission scope — it only exists at the GitHub App configuration level, not at the token level.

Where in the code

Invalid mapping:

  • pkg/workflow/safe_outputs_app.go:235-237 — maps PermissionDiscussions to permission-discussions:
if level, ok := permissions.Get(PermissionDiscussions); ok {
    fields["permission-discussions"] = string(level)
}

Test asserting incorrect behavior:

  • pkg/workflow/safe_outputs_app_test.go:152-153 — asserts permission-discussions: write should be present in output

Related: permission-attestations may have the same issue:

  • actions/create-github-app-token#310 reports the same pattern for attestations
  • If a similar mapping block exists for PermissionAttestations in safe_outputs_app.go, it should be removed too

Evidence

Proposed fix

  1. Remove the 3-line PermissionDiscussions mapping block in safe_outputs_app.go:235-237
  2. Add PermissionDiscussions to the comment listing permissions with no GitHub App equivalent
  3. Check if PermissionAttestations has the same pattern — if so, remove it too
  4. Update test assertions in safe_outputs_app_test.go to remove expectations for the deleted mappings
  5. Run make agent-finish to validate

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions