Skip to content

gh aw compile does not add pull-requests: write to safe_outputs job when add-comment is configured #18311

@ViktorHofer

Description

@ViktorHofer

Bug

When a workflow defines safe-outputs: add-comment, gh aw compile generates the safe_outputs job with issues: write but not pull-requests: write. This causes the safe-output to fail with:

Resource not accessible by integration

when the agent tries to post a comment on a pull request.

Repro

Workflow frontmatter:

permissions:
  contents: read
  actions: read
  issues: read
  pull-requests: read

safe-outputs:
  add-comment:
    max: 3

Compiled lock file safe_outputs job permissions:

safe_outputs:
    permissions:
      contents: read
      discussions: write
      issues: write
      # pull-requests: write  <-- MISSING

Expected

The compiler should add pull-requests: write to the safe_outputs job since add-comment can target both issues and pull requests.

Workaround

Manually edit the lock file to add pull-requests: write to the safe_outputs job permissions after compiling.

Example failure

https://github.com/ViktorHofer/msbuild-s1/actions/runs/22392168067 (safe_outputs job, "Process Safe Outputs" step)

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions