# actions/checkout v7: what changed since v4

v7 refuses fork pull request code in pull_request_target workflows, and so do v4, v5 and v6 since July. Here is every change since v4, the error, and the fixes.

November 27, 2026, by Supercorp.

`actions/checkout` v7 came out on 18 June 2026. Most workflows can move to it by changing the number. The one change that breaks workflows reached the older versions as well: since 20 July 2026, `@v4`, `@v5` and `@v6` refuse to check out a fork's pull request in a `pull_request_target` or `workflow_run` workflow, and fail with "Refusing to check out fork pull request code". Here is what changed in each version since v4, what that error means, and what to do about it before GitHub's next step on 2 December.

## What changed, version by version

From the [README](https://github.com/actions/checkout) and the [releases](https://github.com/actions/checkout/releases):

| Version | Released | What changed | What it needs |
|---|---|---|---|
| v4 | 17 October 2023 | Runs on Node.js 20 | |
| v5 | 11 August 2025 | Runs on Node.js 24 | Runner 2.327.1 or newer |
| v6 | 20 November 2025 | The token is kept in a file under `$RUNNER_TEMP`, not in `.git/config`; `git push` and `git fetch` still work | Runner 2.329.0 or newer, for authenticated `git` inside Docker container actions |
| v7 | 18 June 2026 | Refuses fork pull request code in `pull_request_target` and `workflow_run` workflows; rebuilt as an ES module | |

On GitHub's own runners the runner is always new enough. On your own runners, the versions matter: a runner older than 2.327.1 cannot run v5 or later.

## The refusal, also in v4, v5 and v6

From v7 on, a checkout step fails when the workflow was started by `pull_request_target`, or by `workflow_run` after a `pull_request` event, the pull request comes from a fork, and the step asks for its code:

- `ref: ${{ github.event.pull_request.head.sha }}`
- `ref: refs/pull/${{ github.event.pull_request.number }}/merge`
- `repository: ${{ github.event.pull_request.head.repo.full_name }}`

The step fails with:

```
Refusing to check out fork pull request code from a 'pull_request_target' workflow. This workflow runs with the base repository's GITHUB_TOKEN, secrets, default-branch cache scope, and runner access. Fetching and executing a fork's code in that trusted context commonly leads to "pwn request" vulnerabilities. To opt in, review the risks at https://gh.io/securely-using-pull_request_target and set 'allow-unsafe-pr-checkout: true' on the actions/checkout step.
```

GitHub [backported it](https://github.blog/changelog/2026-06-18-safer-pull_request_target-defaults-for-github-actions-checkout/) on 20 July 2026, as v6.1.0, v5.1.0, v4.4.0, v3.7.0 and v2.8.0. A workflow that says `@v4` got it that day without a change. One pinned to a full commit SHA or an exact version such as `@v4.2.2` did not, and gets it when it is next updated. v1 was left as it was.

Pull requests from branches of the same repository are not affected, and neither is the `pull_request` event.

## Why: pwn requests

`pull_request_target` runs with the base repository's `GITHUB_TOKEN` and secrets, which is safe as long as it runs the base repository's own code. Checking out the fork's code and then running it (a `make test`, an `npm install` with its install scripts) hands those secrets to whoever opened the pull request. GitHub's guide, [Securely using pull_request_target](https://docs.github.com/en/actions/reference/security/securely-using-pull_request_target), calls this a "pwn request" and "the root cause of multiple supply-chain compromises".

## What to do

**1. Use `pull_request` if the job needs no secrets.** It runs on the same events, runs the pull request's code, and gives forks a read-only token and no secrets. Most CI belongs here; `pull_request_target` is often there only because someone once needed a secret.

**2. Split the work if it does need secrets.** Run the fork's code under `pull_request`, with no secrets, and save what it produces as an artifact. A second workflow, on `workflow_run`, runs with secrets and reads that artifact as data, without checking out or running anything from the fork:

```yaml
name: test  # .github/workflows/test.yml: the fork's code, no secrets
on: pull_request
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - run: npm ci && npm test -- --coverage
      - uses: actions/upload-artifact@v7
        with:
          name: coverage
          path: coverage/coverage-summary.json
```

```yaml
name: report  # .github/workflows/report.yml: secrets, no fork code
on:
  workflow_run:
    workflows: [test]
    types: [completed]
jobs:
  report:
    runs-on: ubuntu-latest
    permissions:
      actions: read
      pull-requests: write
    steps:
      - uses: actions/download-artifact@v8
        with:
          name: coverage
          run-id: ${{ github.event.workflow_run.id }}
          github-token: ${{ github.token }}
      - run: node -e "console.log(require('./coverage-summary.json').total.lines.pct)"
```

GitHub's guide warns that a `workflow_run` workflow "should treat artifacts uploaded by other workflows as untrusted": read them, never run them.

**3. Opt in, if the code is never run.** Some workflows check out a fork's code only to read it, to label a pull request by the files it changes, say. After reviewing that, `allow-unsafe-pr-checkout: true` on the step lets it through:

```yaml
- uses: actions/checkout@v7
  with:
    ref: ${{ github.event.pull_request.head.sha }}
    allow-unsafe-pr-checkout: true
```

The protection covers `actions/checkout` only. A `git fetch`, a `gh pr checkout` or a downloaded artifact that is then run is just as dangerous, and nothing stops it.

## Next: `pull_request_target` blocked in public repositories

A second change follows on 2 December 2026. GitHub has added a default policy to public repositories that blocks workflows started by `pull_request_target` altogether. It runs in "evaluate" mode now, so runs continue and the policy's insights show which would be stopped; from 2 December, [GitHub's guide](https://docs.github.com/en/actions/reference/security/securely-using-pull_request_target#default-policy-for-pull_request_target) says, it is enforced for affected repositories. It does not apply to private or internal repositories.

A public repository that still needs `pull_request_target`, for labeling or for comments on pull requests from forks, has to allow it in an Actions event policy before then. One that does not need it can move those workflows to `pull_request` now.

## Which version to pin

`@v7` gets fixes as they are released, as `@v4` got the backport. Pinning a full commit SHA, kept current by Dependabot, guards against a tag being moved; like an exact version, it kept the July change out until the pin was updated. Either way, read the release notes before a major version.

## With SuperCI

GitHub's guide asks that a runner that may run untrusted code be "isolated and ephemeral", and not reused across runs. SuperCI, which we make, runs GitHub Actions jobs on fresh machines in your own AWS, Cloudflare or Modal account, one for each job, and ends the machine with the job: nothing one pull request's code leaves behind reaches the next job. [How it works](/docs/how-it-works) has the rest.

Related: [GitHub Actions concurrency groups](/blog/github-actions-concurrency), and [the GitHub Actions cache](/blog/github-actions-cache-limit), whose writes from `pull_request_target` are read-only for the same reason.
