Skip to content

Compiler unconditionally adds invalid discussions: write permission to safe-output jobs #25467

Closed

Description

@IEvangelist

Summary

The gh aw compile command (v0.67.2) unconditionally adds discussions: write to the job permissions and permission-discussions: write to the create-github-app-token inputs for the conclusion and safe_outputs jobs whenever add-comment is configured in safe-outputs. However, discussions is not a valid GitHub Apps API permission scope, causing token minting to fail with:

HTTP 422: The permissions requested are not granted to this installation.

The create-github-app-token@v3 action also warns:

Unexpected input(s) 'permission-discussions', valid inputs are [... 'permission-team-discussions' ...]

Reproduction

  1. Create a workflow with add-comment in safe-outputs using a github-app block:

    safe-outputs:
      github-app:
        app-id: ${{ secrets.APP_ID }}
        private-key: ${{ secrets.APP_PRIVATE_KEY }}
        owner: "myorg"
        repositories: ["myrepo"]
      add-comment:
        target-repo: "myorg/myrepo"
  2. Run gh aw compile

  3. Observe the compiled .lock.yml contains:

    # In conclusion job:
    permissions:
      discussions: write    # <-- invalid
      issues: write
    
    # In conclusion and safe_outputs token steps:
    permission-discussions: write  # <-- not a valid GitHub Apps permission
  4. When the workflow runs, create-github-app-token makes a POST to /app/installations/{id}/access_tokens requesting discussions: write, which the GitHub API rejects.

Attempted workarounds

  • Setting discussion: false on add-comment is rejected by the compiler: error: 'discussion': value must be true
  • Omitting discussion entirely still produces discussions: write in the lock file
  • Manually patching the lock file works but is undone by every recompile

Expected behavior

The compiler should either:

  1. Not add discussions: write when the workflow doesn't use create-discussion / update-discussion / close-discussion safe outputs
  2. Accept discussion: false on add-comment to opt out of discussion support
  3. Use the correct API permission name (team_discussions if targeting team discussions)

Environment

  • gh aw CLI: v0.67.2
  • OS: Windows 11 / Ubuntu (GitHub Actions)
  • create-github-app-token: v3 (SHA f8d387b68d61c58ab83c6c016672934102569859)

Impact

This blocks ALL workflows that use add-comment with github-app authentication. We've had 6+ PRs trying to fix this in microsoft/aspire — each recompile reintroduces the bug.

Current workaround: surgical post-compile sed script to strip the 4 invalid lines.

Activity

  1. locked and limited conversation to collaborators on Apr 9, 2026
  2. unlocked this conversation on Apr 9, 2026
  3. pelikhan commented on Apr 9, 2026

    @pelikhan
    Collaborator

    @copilot fix Setting discussion: false on add-comment is rejected by the compiler: error: 'discussion': value must be true

    The user should be able to disable discussions support in the front matter.

    Keep the same defaults.

  4. pelikhan commented on Apr 10, 2026

    @pelikhan
    Collaborator

    Try this (plural)

    add-comment:
    discussions: false

    The GitHub app permissions is an issue on the actions create side which is being tracked by the github actions team

  5. pelikhan commented on Apr 10, 2026

    @pelikhan
    Collaborator

    (reopen as needed)

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions