---
title: "A manual deploy ran on the branch, not on the commit you reviewed | Proofline"
description: "A workflow_dispatch run takes the last commit on the branch you pick at the moment you press the button."
url: https://proofline.sh/learn/workflow-dispatch-deploys-branch-tip/
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/)

# A manual deploy ran on the branch, not on the commit you reviewed

A workflow\_dispatch run takes the last commit on the branch you pick at the moment you press the button. When someone merges between your review and your click, the deploy ships their commit with your approval. Pass the commit as an input, check out exactly that commit, and refuse to start when it has no passing checks.

Deployment failures The Proofline team December 2, 2026 3 min read

## What the run takes

GitHub's event table gives `workflow_dispatch` a `GITHUB_SHA` of "Last commit on the `GITHUB_REF` branch or tag", where the ref is the "Branch or tag that received dispatch". [Events that trigger workflows](https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#workflow_dispatch)

So `gh workflow run deploy.yml --ref main` names a branch, not a commit. GitHub resolves the branch when it creates the run, and `actions/checkout` then fetches that commit. Nothing in the form shows which commit it will be. The same holds when the trigger is a chat bot or a script that calls the dispatch API with a branch name.

## Read which commit a past deploy shipped

The run records the commit it resolved:

```
gh api repos/OWNER/REPO/actions/runs/RUN_ID \
  --jq '.event, .head_branch, .head_sha, .created_at'
```

Compare `head_sha` with the commit in the approval, the change ticket or the release note. If they differ, list what the deploy added:

```
git log --oneline REVIEWED_SHA..HEAD_SHA
```

An empty list with different IDs means the reviewed commit is not an ancestor of the shipped one. Check `git log --oneline HEAD_SHA..REVIEWED_SHA` too: a force-push may have replaced the reviewed commit.

## Pin the commit in the workflow

Take the commit as a required input, check it out, and confirm it belongs to the branch and passed its checks before anything deploys:

```
on:
  workflow_dispatch:
    inputs:
      sha:
        description: Full commit SHA to deploy
        required: true

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
        with:
          ref: ${{ inputs.sha }}
          fetch-depth: 0
      - name: Commit is on the dispatched branch
        run: git merge-base --is-ancestor "$SHA" "origin/$GITHUB_REF_NAME"
        env:
          SHA: ${{ inputs.sha }}
      - name: Required check passed on this commit
        run: |
          gh api "repos/$GITHUB_REPOSITORY/commits/$SHA/check-runs?check_name=test" \
            --jq '[.check_runs[] | select(.conclusion == "success")] | length' \
            | grep -qx '[1-9][0-9]*'
        env:
          SHA: ${{ inputs.sha }}
          GH_TOKEN: ${{ github.token }}
```

The input goes through `env`, not straight into the script, so a crafted value cannot inject shell. Replace `test` with your required check's name. `actions/checkout` documents `ref` as "The branch, tag or SHA to checkout". [actions/checkout](https://github.com/actions/checkout#usage) Pass the full 40-character SHA: an abbreviated one can become ambiguous as the repository grows.

The check-run lookup proves that a check of that name passed on that commit. It does not prove which workflow reported it. If another app could post the same name, pin the source as [a required check pinned to its app](/learn/required-check-expected-source/) describes.

## Decide

| `head_sha` vs reviewed commit | What shipped |
| --- | --- |
| Equal | What you reviewed |
| Reviewed is an ancestor | Your change plus the listed later commits, none of which you approved for this deploy |
| Not an ancestor | A branch rewritten after the review. Find where the reviewed commit went before you deploy again |

## Worked example

This example is fictional. Ana reviews `release-2.4` at `8c1f0e2` and posts "ship it" at 14:02 UTC. At 14:05 Ben merges a config change into `release-2.4`. At 14:09 Chen presses Run workflow on `release-2.4`. The run's `head_sha` is `d47a913`, and `git log 8c1f0e2..d47a913` lists Ben's commit. Its tests passed, so nothing went red. Ben's change had no review for this release. With the `sha` input, Chen would have pasted `8c1f0e2` and shipped what Ana approved, and Ben's change would wait for its own deploy.

A deploy that downloads a build has the same gap one step later: see [an artifact from another run](/learn/artifact-from-another-run/) and [promoting the tested artifact](/learn/promote-tested-artifact-not-rebuild/).

## 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

-   ### [Your job downloaded an artifact from another run. Which commit built it?](/learn/artifact-from-another-run/)
    
    Deployment failures The Proofline team December 2, 2026 3 min read
    
-   ### [Should the release job rebuild the commit or promote the artifact you tested?](/learn/promote-tested-artifact-not-rebuild/)
    
    Deployment failures The Proofline team December 2, 2026 3 min read
