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

create_pull_request doesn't check out branch when called from pull_request event #242

Closed
georeith opened this issue Sep 5, 2024 · 0 comments · Fixed by #244
Closed

create_pull_request doesn't check out branch when called from pull_request event #242

georeith opened this issue Sep 5, 2024 · 0 comments · Fixed by #244
Labels
bug Something isn't working

Comments

@georeith
Copy link
Contributor

georeith commented Sep 5, 2024

Describe the bug
create_pull_request does not check out the correct branch when called from an action triggered by pull_request events, this means it runs on your main branch and attempts to PR any changes on main that aren't on your PR too.

The issue is that GITHUB_REF doesn't refer to the branch name on an action triggered via pull_request event it looks like: refs/pull/{pr_number}/merge.

git checkout "${GITHUB_REF#refs/heads/}"

It should instead use ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}.

image
source

@georeith georeith added the bug Something isn't working label Sep 5, 2024
@georeith georeith changed the title Create PR doesn't check out branch when called from pull_request event create_pull_request doesn't check out branch when called from pull_request event Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant