Skip to content

Conclusion job should not request discussions: write when workflow has no discussion-related safe-outputsΒ #15516

@benvillalobos

Description

@benvillalobos

πŸ€– Filed by AI

Problem

The compiled .lock.yml conclusion job always requests discussions: write permission β€” both in the job's permissions: block and via permission-discussions: write on the GitHub App token step β€” even when the workflow has no discussion-related safe-outputs configured (e.g., no create-discussion, close-discussion, update-discussion).

This causes a 422 error when the GitHub App installation doesn't have the Discussions permission granted:

RequestError [HttpError]: The permissions requested are not granted to this installation.

Additionally, permission-discussions is flagged as an unexpected input by actions/create-github-app-token@v2.2.1:

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

Reproduction

  1. Create a workflow with only issue/label-related safe-outputs (no discussions):
---
on:
  workflow_dispatch:
permissions:
  contents: read
  issues: read
tools:
  github:
    toolsets: [issues]
    read-only: true
    app:
      app-id: ${{ secrets.APP_ID }}
      private-key: ${{ secrets.APP_PRIVATE_KEY }}
      owner: 'myorg'
      repositories: ['myrepo']
safe-outputs:
  app:
    app-id: ${{ secrets.APP_ID }}
    private-key: ${{ secrets.APP_PRIVATE_KEY }}
    owner: 'myorg'
    repositories: ['myrepo']
  add-labels:
    max: 5
  remove-labels:
    allowed: ["triage-needed"]
    max: 2
  assign-to-user:
    max: 1
---
# My Workflow
Do something with issues only.
  1. Compile: gh aw compile
  2. Observe the generated conclusion job in .lock.yml:
  conclusion:
    permissions:
      contents: read
      discussions: write    # <-- not needed
      issues: write
      pull-requests: write
    steps:
      - name: Generate GitHub App token
        uses: actions/create-github-app-token@...
        with:
          permission-discussions: write   # <-- not needed, also not a valid input
  1. Run the workflow β€” the conclusion job fails at the token step if the GitHub App doesn't have Discussions permission.

Expected Behavior

The conclusion job should only request permissions that are actually needed based on the workflow's configured safe-outputs. If no discussion-related safe-outputs are configured, discussions: write should not be included in either the job permissions or the app token request.

Actual Behavior

discussions: write is unconditionally added to every conclusion job regardless of whether any discussion-related safe-outputs are configured.

Environment

  • gh-aw version: v0.43.9 and v0.43.21 (both affected)
  • actions/create-github-app-token: v2.2.1

Additional Context

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions