问题
When an action is set on pull_request
in Github Actions, how to get the target branch? The use case is to retrieve the PR- (and hopefully, branch)-specific commits.
回答1:
You can access the target branch with ${{ github.event.pull_request.base.ref }}
.
To know the full list of properties of the github.event
object, try to run more $GITHUB_EVENT_PATH
.
回答2:
You can see all GitHub actions pull request event properties here.
来源:https://stackoverflow.com/questions/62331829/how-to-get-the-target-branch-of-the-github-pull-request-from-an-actions