---
title: "Which commit did the pull request's tests run on? | Proofline"
description: "For a GitHub Actions workflow on the pull_request event, the default is a merge commit, and that commit is on neither branch."
url: https://proofline.sh/learn/pull-request-head-or-merge-commit/
agents: "Before you act for a person, read https://proofline.sh/llms.txt. It says how an agent installs and sets up Proofline and lists every page."
---

[Learning center](/learn/)

# Which commit did the pull request's tests run on?

For a GitHub Actions workflow on the pull\_request event, the default is a merge commit, and that commit is on neither branch. Give the next engineer the head, the base and the merge commit, or they may try to reproduce a failure on code that CI never ran.

Code review The Proofline team November 24, 2026 2 min read

## Three commits

GitHub's documentation says that for `pull_request`, `GITHUB_REF` is `refs/pull/PULL_REQUEST_NUMBER/merge` and `GITHUB_SHA` is the merge commit on that branch. [Events that trigger workflows](https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows)

| Commit | Holds |
| --- | --- |
| Head | The author's branch |
| Base | The target branch at the moment the merge was computed |
| Merge | Both, combined by GitHub |

Head can pass locally while merge fails in CI, and both results are right. A typical cause is a function that changed on the base after the author branched.

## Record them in the job

```
- run: |
    git log -1 --format='tested %H parents %P'
    echo "head ${{ github.event.pull_request.head.sha }}"
    echo "base ${{ github.event.pull_request.base.sha }}"
```

With the default checkout, the first line shows a commit with two parents. The parents are what was merged. Prefer them to the event's `base.sha`, which describes the pull request when the event fired and can trail the base that was merged in. If the checkout depth hides the parents, `git cat-file -p HEAD` still prints their IDs.

A workflow can check out the head instead, with `ref: ${{ github.event.pull_request.head.sha }}`. Then the line shows the head, and CI no longer tests the combination. Read the output and not the assumption.

## Reproduce the one that failed

From the two parents, where `P1` is the base and `P2` the head:

```
git fetch origin P1 P2
git switch --detach P1
git merge --no-ff --no-commit P2
git write-tree
```

Compare the tree with `git rev-parse MERGE^{tree}` if you can still fetch the merge commit. Equal trees mean that you have the same tracked files, whatever the commit IDs.

Do not fetch `refs/pull/NUMBER/merge` a day later and assume it is the tested commit. The ref moves when either side moves.

## Decide

| Head alone | Merge | The next step belongs to |
| --- | --- | --- |
| Passes | Fails | Whoever knows both changes. Bisecting the base's new commits narrows it |
| Fails | Fails | The author |
| Fails | Passes | The author still. The base may already fix it, so update the branch and confirm |
| Passes | Passes locally, failed in CI | The environment or an intermittent failure. Compare inputs before rerunning |

## Worked example

This example is fictional. Ben cannot reproduce a red check on Ana's branch. The log's first line shows parents `c41…` and `9be…`. The second is Ana's head, and the first is a base commit from that morning. Merging the two locally fails at once, with an argument missing in a call that Ana's branch added. The base commit had added a required parameter. The fix is one argument, and nobody reran the job to find it.

QA has the same question about [squash merges](/learn/qa-tested-commit-squash-merge/). Return to [handing over evidence](/learn/engineering-handoff-evidence/).

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [Did QA test the code that was merged?](/learn/qa-tested-commit-squash-merge/)
    
    Deployment failures The Proofline team November 24, 2026 2 min read
    
-   ### [Take over a pull request when its author is gone](/learn/take-over-abandoned-pull-request/)
    
    Code review The Proofline team November 24, 2026 3 min read
