I have a GitHub Actions workflow which is triggered only on push to the master
(aka main
) branch.
on:
push:
branches:
- master
I only push to master
via merging GitHub pull requests, not via directly committing changes to master
and pushing them.
Within the steps of the job in this workflow, I would like to reference the pull request which was merged to lead to the merge commit which was pushed to master. What is the simplest way to achieve this?
I've tried to find such a reference in the GitHub Actions github
context object, and the most promising property I found was github.event
. In my case, this would be the push
event, but within this event object I can find no property that will lead me to the pull request that led to the pushed (merge) commit.
Is there some context or webhook object property I have not discovered which would hold this information? If not, how else can I uncover it? If possible, I would prefer to avoid using 3rd party GitHub actions, from a security perspective.