Skip to content
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

Ensure PR preview deletion is working correctly in all cases #696

Closed
gwarf opened this issue Jan 9, 2025 · 3 comments · Fixed by #697
Closed

Ensure PR preview deletion is working correctly in all cases #696

gwarf opened this issue Jan 9, 2025 · 3 comments · Fixed by #697

Comments

@gwarf
Copy link
Member

gwarf commented Jan 9, 2025

As documented in #692, the PR preview deletion worked well when removing a label set on a PR created in a feature branch of this repo: PR #664 with https://github.com/EGI-Federation/documentation/actions/runs/12688246198/job/35364361677, but failed when a PR created in a branch from a fork was merged: PR $685 with https://github.com/EGI-Federation/documentation/actions/runs/12688986914/job/35366700297

Apparently the exact same workflow was used, but looking at the actions, the permissions where not the same (cf captures at #692 (comment)):

Screenshot 2025-01-09 at 14 54 32

vs

Screenshot 2025-01-09 at 14 54 42

@gwarf
Copy link
Member Author

gwarf commented Jan 9, 2025

So looking at https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication:

You can use the permissions key to add and remove read permissions for forked repositories, but typically you can't grant write access.

@gwarf
Copy link
Member Author

gwarf commented Jan 9, 2025

So maybe we have to use a similar logic as what we do for deploying the PR, with the deploy workflow that is triggered when the build pull request has been completed:

on:
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_run
workflow_run:
workflows: ["Build pull request preview"]
types: [completed]

@gwarf
Copy link
Member Author

gwarf commented Jan 9, 2025

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 a pull request may close this issue.

1 participant