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

fix: Example pull_request_target: is wrong and very badly broken #23

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vorburger
Copy link
Contributor

@vorburger vorburger commented Nov 2, 2023

see www-learn-study/saraswati.learn.study#47

If you use pull_request_target: instead of pull_request: then the actions/checkout, at least in its current v4.1.1, will always check out the default branch, not the pull request; see https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target

see www-learn-study/saraswati.learn.study#47

If you use pull_request_target: instead of pull_request: then the `actions/checkout`, at least in v4.1.1, will always check out the default branch, not the pull request.
@EndBug
Copy link
Owner

EndBug commented Nov 7, 2023

Hi, I see that you're not checking out the repo as in the example: if you don't provide the ref I'm using in the example, actions/checkout will check out the default branch.

Ref I'm using:

ref: refs/pull/${{ github.event.pull_request.number }}/merge

Your step:
https://github.com/www-learn-study/saraswati.learn.study/blob/eee50b03e235fe3b4746008e1a656d0a33ddb1bb/.github/workflows/preview.yaml#L28-L31

Be careful with using these kinds of workflows with pull_request: is the workflow is changed in the PR, the author may be able to run something you don't expect

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.

2 participants