I have a GitHub action workflow where I am doing a merge of various different source branches into target branch main.
When I look at GITHUB_REF it contains main branch.
How do I get the name of the source branch?
I have a GitHub action workflow where I am doing a merge of various different source branches into target branch main.
When I look at GITHUB_REF it contains main branch.
How do I get the name of the source branch?
To have access to all the properties of the event that triggered the action, you can look-up the path in the variable $GITHUB_EVENT_PATH
(it's a json describing the event).
You can then access it using ${{ github.event.<the path in the json> }}
. In your case ${{ github.event.pull_request.base.ref }}
should have the info you are looking for.
Potential duplicate with this question?