Learning center

A pull_request_target check is green. Did it test the pull request?

Usually not. A workflow triggered by pull_request_target runs the workflow file from the repository's default branch, and actions/checkout without a ref checks out that branch too, yet the check appears on the pull request's head commit. Treat its green as a result about the default branch plus whatever the job read from the event, and look for a pull_request or merge_group run for evidence about the change's code.

What the event runs#

GitHub's event reference lists GITHUB_SHA for pull_request_target as the "Last commit on default branch" and says the event "runs in the context of the default branch of the base repository, rather than in the context of the merge commit". Events that trigger workflows

The security guide adds the checkout: "the workflow, and any subsequent actions/checkout call that does not specify a ref, is taken from the base repository's default branch". Securely using pull_request_target That is the default branch even when the pull request targets a release branch.

A real run#

This public run checks that a fork pull request filled in its template. The workflow is written to stay safe: it reads only the template file and never checks out the head.

run 46734728138 event pull_request_target conclusion success
run head_sha c6f7d2d75aedada07e6429424413c70e1168edcc
run created_at 2026-12-01T20:10:41Z
check run "Check PR Template" success on c6f7d2d75aedada07e6429424413c70e1168edcc
checked out by actions/checkout:
[command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --filter=blob:none --depth=1 origin +0062b93a70248c0ba7c8dda48b6c2e2e767dc758:refs/remotes/origin/main
[…]
[command]/usr/bin/git log -1 --format=%H
0062b93a70248c0ba7c8dda48b6c2e2e767dc758
0062b93 committed 2026-12-01T20:08:51Z: chore: bump node to v26.14.0 (main) (#56127)

The run's head_sha and the check run both name the pull request's head, c6f7d2d. The files on disk came from 0062b93, a default-branch commit dated two minutes before the run. Nothing on the pull request page shows that difference.

What the green covers#

The jobWhat a pass showsEvidence about the change's code?
Reads only event data: title, body, labels, file listThe metadata met the ruleNo
Checks out with no ref and runs testsThe default branch passedNo
Checks out head.sha and runs itThe head passed, with secrets in reachYes, but this is the pwn request pattern

The third row is why the shortcut is dangerous. GitHub's guide shows a workflow that checks out the head and runs make test, and explains that a fork's Makefile then runs "with the base repository's secrets and token". GitHub Security Lab describes the same attack in preventing pwn requests. Current actions/checkout refuses a fork's head ref under pull_request_target unless the workflow sets allow-unsafe-pr-checkout: true, an input named to stand out in review. A workflow without that input that still reports the head as tested is probably fetching the code another way, which the guide lists as equally unsafe.

Find the run that tested the change#

Filter the runs on the head commit by event:

gh api "repos/OWNER/REPO/actions/runs?head_sha=HEAD_SHA" \
  --jq '.workflow_runs[] | [.event, .name, .conclusion] | @tsv'

A pull_request run tested the merge commit of the head and the base, as described in which commit the tests ran on. If the only runs are pull_request_target, no GitHub Actions workflow has tested the change's code, however many checks are green. A check from an external CI service reports through statuses or its own app; read what it checked out the same way. For fork pull requests that wait for approval, see required checks on fork pull requests.

Return to handing over 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.

Start free with GitHub

Related reading