Skip to content

Add required permissions to the workflow_run example - #45612

Merged
subatoi merged 1 commit into
github:mainfrom
erekola:workflow-run-example-permissions
Aug 25, 2026
Merged

Add required permissions to the workflow_run example#45612
subatoi merged 1 commit into
github:mainfrom
erekola:workflow-run-example-permissions

Conversation

@erekola

@erekola erekola commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Why:

Closes: #45520

The workflow_run "Use the data" example downloads an artifact from the triggering run and then posts a comment with github.rest.issues.createComment, and it declares no permissions: key. Downloading an artifact is documented as needing Actions: read, and creating an issue comment as Issues: write or Pull requests: write. The restricted repository default grants read access to contents and packages only, and the workflow permissions reference says the effective token starts from that default and changes only through a permissions: key. So a reader who copies the example into a repository on the restricted default gets a workflow that can do neither. On a permissive default it works. That is why the gap is easy to miss.

The surrounding section is about handling a potentially untrusted triggering workflow, and the example already carries a security comment about not extracting into the workspace directory. That makes it the example a reader is most likely to copy verbatim and least likely to widen by hand.

What's being changed (if available, include any code snippets, screenshots, or gifs):

A job-level permissions: block on the download job:

permissions:
  actions: read
  issues: write

pull-requests: write is the documented alternative to issues: write here, not a third permission. Nothing else in the example changes.

Check off the following:

  • A subject matter expert (SME) has reviewed the technical accuracy of the content in this PR. In most cases, the author can be the SME. Open source contributions may require an SME review from GitHub staff.
  • The changes in this PR meet the docs fundamentals that are required for all content.
  • All CI checks are passing and the changes look good in the review environment.

I am not GitHub staff, so I left the SME box for a maintainer. The reasoning, the pages I read for the two requirements and the three things that would make the report wrong are in #45520.

@subatoi subatoi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you, @erekola—I'll go ahead and get this merged now 🙇

@subatoi
subatoi added this pull request to the merge queue Aug 25, 2026
Merged via the queue into github:main with commit 0dddeeb Aug 25, 2026
44 checks passed
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.

workflow_run "Use the data" example omits the permissions the example itself needs

2 participants