---
title: "Your job downloaded an artifact from another run. Which commit built it? | Proofline"
description: "Whatever commit that other run checked out, which need not be the one your job runs on."
url: https://proofline.sh/learn/artifact-from-another-run/
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/)

# Your job downloaded an artifact from another run. Which commit built it?

Whatever commit that other run checked out, which need not be the one your job runs on. A step that fetches "the latest successful" artifact picks a run by time and conclusion. Before you deploy or test what you downloaded, read the source run's head\_sha and the artifact's digest, and fail the job when the commit is not the one you ship.

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

## How a job ends up with another run's files

`actions/download-artifact` reads from the current run by default. Its README says the `github-token` input "is required when downloading artifacts from a different repository or from a different workflow run", and that `run-id` defaults to `${{ github.run_id }}`. [actions/download-artifact](https://github.com/actions/download-artifact#inputs) A job that sets `run-id` gets exactly that run's artifact; the question moves to how the job chose the ID.

Third-party actions choose for you. The README of `dawidd6/action-download-artifact` says that if none of `commit`, `pr`, `branch`, `ref`, `run_id` or `workflow_conclusion` is specified, "the artifact from the most recent successfully completed workflow run will be downloaded". [dawidd6/action-download-artifact](https://github.com/dawidd6/action-download-artifact#usage) If the newest successful run was for another commit, or for another branch's queue, that is the artifact you get, and the step still succeeds.

## The same commit, two different artifacts

The artifacts API records the run behind each artifact, including `workflow_run.head_sha` and `head_branch`, and a `digest`. [Artifacts REST API](https://docs.github.com/en/rest/actions/artifacts) Listing the newest artifacts named `screenshots-linux` in a public game engine repository:

```
[…]
15568746384	2026-12-02T03:49:46Z	46803585219	main	70ce41556e4b	sha256:c01dd413d250717b
15565787377	2026-12-02T03:07:50Z	46799036202	gh-readonly-queue/main/pr-25664-5d378cf5459999ab2c639cc07599c59a9a1fcf33	70ce41556e4b	sha256:526314191275a030
15554352694	2026-12-02T00:13:24Z	46774671184	main	5d378cf54599	sha256:1e5cae8a45339284
[…]
```

The columns are artifact ID, creation time, source run, branch, commit and the start of the digest. The first two came from a `push` run and a `merge_group` run of the same workflow on the same commit, and their digests differ. A matching commit says which source built the files. It does not say two builds of it produced the same bytes. Here the two uploads differ, and a change in any file or in the archive itself would produce that.

## Check before you use it

Look up the artifact you are about to download:

```
gh api --paginate "repos/OWNER/REPO/actions/artifacts?name=ARTIFACT_NAME&per_page=100" \
  --jq '.artifacts[] | [.id, .workflow_run.id, .workflow_run.head_sha, .digest] | @tsv'
```

In the workflow, pass the run explicitly and compare the commit:

```
permissions:
  actions: read
steps:
  - uses: actions/download-artifact@v8
    with:
      name: build
      github-token: ${{ github.token }}
      run-id: ${{ inputs.build_run_id }}
  - run: |
      built=$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$BUILD_RUN_ID" --jq .head_sha)
      test "$built" = "$GITHUB_SHA" || { echo "artifact built from $built"; exit 1; }
    env:
      GH_TOKEN: ${{ github.token }}
      BUILD_RUN_ID: ${{ inputs.build_run_id }}
```

The run ID reaches the shell as an environment variable, not as text pasted into the script. GitHub's [secure use reference](https://docs.github.com/en/actions/reference/security/secure-use) recommends this intermediate environment variable. The run's `head_sha` is the commit its event named; a build job that checks out another ref, such as a pull request's head, builds other source, so read the source workflow's checkout step too.

## What a match covers

| Observation | What it shows | What it cannot exclude |
| --- | --- | --- |
| Source run `head_sha` equals your commit | The files came from a run on that commit | A different build of that commit with different bytes |
| Digest equals the one you recorded | The bytes are the ones you recorded | Nothing about the commit, unless you recorded both together |
| Source run is a `pull_request` run | It built the merge commit with the base at that time | That the base has not moved since |

The download action checks the digest against the server's value and fails on a mismatch by default (`digest-mismatch: error`). That protects the transfer, not the choice of run.

Artifacts expire with the retention period; see [keeping review CI artifacts](/learn/retain-review-ci-artifacts/) and [promote the tested artifact](/learn/promote-tested-artifact-not-rebuild/). 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

-   ### [When to copy a CI artifact cited by a code review](/learn/retain-review-ci-artifacts/)
    
    Code review The Proofline team November 23, 2026 1 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
