Skip to content

Reduce workflow permissions to match lock file requirements#266

Merged
strawgate merged 4 commits intomainfrom
copilot/reduce-workflow-permissions
Feb 21, 2026
Merged

Reduce workflow permissions to match lock file requirements#266
strawgate merged 4 commits intomainfrom
copilot/reduce-workflow-permissions

Conversation

Copy link
Contributor

Copilot AI commented Feb 21, 2026

discussions: write and pull-requests: write were added to several workflows as a workaround for a gh-aw compiler issue (github/gh-aw#16673). With the new compiler version these are no longer needed — the regenerated lock files reflect actual requirements.

Changes

Compared every trigger/example file's granted permissions against the union of job-level permissions in the corresponding .lock.yml:

  • Removed discussions: write from pr-checks-fix, pr-ci-detective, pr-ci-fixer (trigger + example)
  • Downgraded pull-requests: writeread in duplicate-issue-detector, pr-ci-detective, issue-triage, pr-checks-fix, pr-ci-fixer (trigger + example) — comments are posted via COPILOT_GITHUB_TOKEN so only read access is needed for the workflow token
  • Removed stale # required by gh-aw compiler for add-comment (github/gh-aw#16673) comments from all files

Kept (verified needed per lock files)

discussions: write and pull-requests: write are retained where lock files actually declare them in job-level permissions and the workflow token genuinely needs write access: issue-triage-pr, mention-in-issue, mention-in-pr.

Original prompt

This section details on the original issue you should resolve

<issue_title>Reduce permissions in workflows</issue_title>
<issue_description>We had added discussions: write and pull-requests: write based on needing github/gh-aw#16673

but now we dont need them anymore that we're on new compiler version.

let's clean these up</issue_description>

<agent_instructions>Look at the final reply from the agent and implement it, double checking granted perms vs lock files, etc</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@strawgate /ai what about now? ive regenerated the lock files

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Remove discussions: write from pr-checks-fix, pr-ci-detective, pr-ci-fixer
  (both trigger and example files) where lock files don't require it
- Downgrade pull-requests: write to pull-requests: read in
  duplicate-issue-detector and pr-ci-detective (both trigger and example
  files) where lock files only need read access
- Remove outdated github/gh-aw#16673 comments from all files

Co-authored-by: strawgate <6384545+strawgate@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove unnecessary permissions from workflows Reduce workflow permissions to match lock file requirements Feb 21, 2026
Copilot AI requested a review from strawgate February 21, 2026 01:21
discussions: write
issues: write
pull-requests: write # required by gh-aw compiler for add-comment (github/gh-aw#16673)
pull-requests: write
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be read, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to pull-requests: read in both the example and trigger file in fe1c46f.

contents: write
discussions: write
issues: write
pull-requests: write
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pull-requests: read

as we're just leaving a comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to pull-requests: read in both the example and trigger file in fe1c46f.

discussions: write
issues: write
pull-requests: write # required by gh-aw compiler for add-comment (github/gh-aw#16673)
pull-requests: write
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be read as we're just leaving a comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to pull-requests: read in both the example and trigger file in fe1c46f.

@strawgate strawgate marked this pull request as ready for review February 21, 2026 01:25
@strawgate
Copy link
Collaborator

@copilot address PR Feedback

…, pr-ci-fixer

Comments are posted via COPILOT_GITHUB_TOKEN so only pull-requests: read
is needed for the workflow token in these workflows.

Co-authored-by: strawgate <6384545+strawgate@users.noreply.github.com>
Copilot AI requested a review from strawgate February 21, 2026 01:27
@strawgate strawgate merged commit 4586188 into main Feb 21, 2026
6 of 7 checks passed
@strawgate strawgate deleted the copilot/reduce-workflow-permissions branch February 21, 2026 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce permissions in workflows

2 participants