pull_request_target in SteerSpec's own workflows

For contributors and maintainers of SteerSpec's public repositories, and for engineers who copy these workflows: why the pull request checks run on pull_request_target, the practice that keeps pull request code from being checked out or run, and the organization Actions event policies to check when you change one of these workflows.

Check what to do when you change a workflow ↓

TL;DR

  • Five of the six workflow files described below never check out or run the pull request's head commit. They read pull request metadata, or read files from the head as data, through the API or with git. The sixth, e2e.yml, runs on pull_request_target only for promotion pull requests from the default branch, can also be run with workflow_dispatch from the default branch, and runs the action under test in a separate test repository, with that repository's own secrets.
  • On pull_request_target, GitHub runs the workflow file from the repository's default branch, so a pull request cannot rewrite the check that judges it.
  • GitHub blocks pull_request_target in public repositories by default from 2 December 2026, unless an Actions event policy allows it. The workflows on this page need such a policy; the organization's policy settings are not public.
  • If you add a workflow file or a trigger, or a repository adopts these workflows or becomes public, ask an organization or enterprise owner to check that the applicable event policies allow it, then check Policy insights for blocked runs.

// The practice: never check out or run pull request code

A workflow triggered by pull_request_target runs in the base repository's context: it can use that repository's secrets, and its GITHUB_TOKEN has whatever permissions the workflow and repository settings give it, which can include write access. GitHub's own guidance is that such a workflow should not check out, build or run code from an untrusted pull request (securely using pull_request_target). Five of the six workflow files described here follow that guidance. None of them checks out github.event.pull_request.head.sha:

  • auto-approve.yml and pr-title.yml check nothing out. They call the GitHub API and read pull request metadata (auto-approve.yml, pr-title.yml).
  • release-changelog.yml checks out main, fetches the pull request head with git and reads its CHANGELOG.md only as data. It does not check out or run the head (release-changelog.yml).
  • bump-version.yml reads one JSON file from the head commit through the API instead of checking it out (bump-version.yml).
  • pr-approval.yml checks nothing out and runs the action pinned to a commit (pr-approval.yml).

The sixth, e2e.yml in strspc-pr-approval, is meant to become the end-to-end gate on a release once its check is required on main. On pull_request_target it runs only for a promotion pull request, whose head is the default branch; it can also be run with workflow_dispatch from the default branch, optionally to test a given commit. It checks out the default branch for its test harness, which holds its token: by name on pull_request_target, and the dispatched default-branch commit on workflow_dispatch. It runs the action under test only in a separate test repository, with that repository's own secrets (e2e.yml).

Each file explains in a comment why it uses this trigger and why that is safe for what it does. If you add a checkout step to one of them, or write a new workflow on this trigger, never check out or run the head commit. If a job has to run the pull request's code, use the pull_request trigger, give that job no secrets, and give it a read-only permissions block (permissions: {} when it needs no API access).

// Why SteerSpec uses pull_request_target

On the pull_request trigger, GitHub runs the workflow file as it is in the pull request. A pull request could then replace a required check with one that always passes, or edit a workflow to read the token it holds. On pull_request_target, GitHub runs the workflow file from the repository's default branch, whatever the pull request changes. The check that judges a pull request is the one already reviewed and merged. The pr-title.yml header states this for the required title check.

// The organization's Actions event policies

From 2 December 2026, a default GitHub policy blocks pull_request_target in public repositories unless an Actions event policy allows it (GitHub docs). The workflows on this page run in a public repository only if an applicable Actions event policy (enterprise, organization or repository) allows pull_request_target for them. The organization's policy settings are not public.

An event policy's event list is an allowlist. When a policy is enforced, GitHub fails a disallowed run with an error such as Event 'workflow_dispatch' is not allowed to trigger Actions workflows (about Actions policies).

// When to check the policies

Before any of these changes takes effect, ask an organization owner (or an enterprise owner, if an enterprise policy applies) to check that the applicable Actions event policies allow it:

  1. A new workflow file that uses pull_request_target in a public repository.
  2. A new trigger in one of the six files above.
  3. A new public repository that adopts these workflows, or a repository that becomes public.

Organization owners manage the policies under the organization's Settings: in the left sidebar, under Actions, click Policies (control workflow execution). After the change, check Policy insights for blocked runs of that workflow.

// Find blocked runs

Organization owners can open Policy insights, directly under Policies in the same sidebar (organization Settings → Actions → Policies). It lists runs that a policy blocked, and runs that a policy in evaluate mode would have blocked. After a workflow change, check it for runs of that workflow.