-
Notifications
You must be signed in to change notification settings - Fork 58.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add necessary permissions to example workflow #31582
Changes from 2 commits
297597c
e92787b
48e5a20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -343,13 +343,15 @@ This example workflow uses `gh-actions-cache` to delete up to 100 caches created | |||||
```yaml | ||||||
name: cleanup caches by a branch | ||||||
on: | ||||||
pull_request: | ||||||
pull_request_target: | ||||||
types: | ||||||
- closed | ||||||
|
||||||
jobs: | ||||||
cleanup: | ||||||
runs-on: ubuntu-latest | ||||||
permissions: | ||||||
actions: write | ||||||
steps: | ||||||
- name: Cleanup | ||||||
run: | | ||||||
|
@@ -369,7 +371,7 @@ jobs: | |||||
env: | ||||||
GH_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} | ||||||
REPO: {% raw %}${{ github.repository }}{% endraw %} | ||||||
BRANCH: refs/pull/{% raw %}${{ github.event.pull_request.number }}{% endraw %}/merge | ||||||
BRANCH: {% raw %}${{ github.ref_name }}{% endraw %} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, using ref_name in workflow_dispatch is the correct approach. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I might have been wrong - There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think this would work @Mogyuchi?
Suggested change
When I used the existing code, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @corneliusroemer |
||||||
``` | ||||||
|
||||||
Alternatively, you can use the API to automatically list or delete all caches on your own cadence. For more information, see "[AUTOTITLE](/rest/actions/cache#about-the-cache-in-github-actions)." | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
permissions
is required regardless of the event if "Read and write permissions" are not selected in the settings(Settings > Actions > General > Actions permissions > Workflow permissions
). In other words, it is not relevant to changing pull_request_target.Therefore, I believe it is more appropriate to make this a separate pull request from #31322 .
This comment was marked as spam.
Sorry, something went wrong.