title: GitHub Actions: On a push-to-master workflow, how can I get a link to the pull request which was merged?
body: <p>I have a GitHub Actions workflow which is triggered only on push to the <code>master</code> (aka <code>main</code>) branch.</p>
  <pre class="lang-yaml prettyprint-override"><code>on:
    push:
      branches:
        - master
  </code></pre>
  <p>I only push to <code>master</code> via merging GitHub pull requests, not via directly committing changes to <code>master</code> and pushing them.</p>
  <p>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?</p>
  <p>I've tried to find such a reference in the GitHub Actions <a href="https://docs.github.com/en/actions/learn-github-actions/contexts#github-context" rel="nofollow noreferrer"><code>github</code> context object</a>, and the most promising property I found was <code>github.event</code>. In my case, this would be the <a href="https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#push" rel="nofollow noreferrer"><code>push</code> event</a>, but within this event object I can find no property that will lead me to the pull request that <em>led to</em> the pushed (merge) commit.</p>
  <p>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.</p>