Skip to content

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

@georeith

Description

@georeith

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions