Which workflow file runs#
GitHub's guide to pull_request_target explains the default plainly. The pull_request event "runs the workflow file from the merge commit of the pull request." For a pull request from a fork, "that commit is controlled by someone without write access to the base repository," and GitHub limits the damage with a read-only token, no secrets and approval policies for fork runs. Securely using pull_request_target
Those limits protect the repository's secrets. They do not protect the merge policy. A required status check is matched by the job's name (troubleshooting rules), so the branch rule accepts any passing job with that name, including one the pull request just rewrote. Pinning the check to the GitHub Actions app does not help either: the rewritten job still runs on GitHub Actions (pinning the expected source).
A fictional one-line change#
Suppose acme/payments requires test on main, with one approving review and no code owner rule. A contributor's pull request changes src/refunds.ts and fails test. In a second commit, the contributor edits the workflow:
name: ci
on:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- run: npm ci
- run: npm test || true
The run step now exits zero whatever the tests do. The workflow file comes from the pull request's merge commit, so the new version runs, test passes, and the merge box turns green. The reviewer reads src/refunds.ts carefully. The workflow diff is one line among many, and nothing on the pull request says that a required check changed definition. One approval satisfies the rule, and the pull request merges with failing tests.
The edit does not have to be deliberate. A refactor that moves a test directory, adds a paths filter, or adds continue-on-error to a flaky step weakens the check the same way.
Give the workflows an owner#
GitHub's Actions hardening guide recommends exactly this control: "if all your workflow files are stored .github/workflows, you can add this directory to the code owners list, so that any proposed changes to these files will first require approval from a designated reviewer." Secure use reference
# .github/CODEOWNERS
/.github/ @acme/ci-platform
/.github/CODEOWNERS @acme/repo-admins
/package.json @acme/ci-platform
/Makefile @acme/ci-platform
Then turn on Require review from Code Owners in the branch rule or ruleset. Without it, CODEOWNERS only requests a review. With it, "any pull request that affects code with a code owner must be approved by that code owner before the pull request can be merged into the protected branch." About protected branches
The pattern /.github/ covers workflow files, local composite actions under .github/actions/, and the CODEOWNERS file itself if you keep it there. GitHub's code owners page says that "To protect a repository fully against unauthorized changes, you also need to define an owner for the CODEOWNERS file itself" (about code owners); the CODEOWNERS file owner guide covers that line. GitHub also says that "pull requests use the version of CODEOWNERS from the base branch" to trigger review requests, so a pull request's own edit to CODEOWNERS does not change who is asked to review it.
The package.json and Makefile lines matter because a workflow that runs npm test delegates the definition of "test" to the test script in package.json. An edit there changes the required check as surely as an edit to the YAML. List every file your required jobs execute by reference.
What code owners do not catch#
Code owner review puts a human in front of the change. It does not make the human notice. A reviewer from @acme/ci-platform approving a large pull request can miss || true as easily as anyone, so keep workflow changes in their own small pull requests where you can.
It also cannot cover everything a test run executes. Test files, fixtures and configuration in the pull request all shape what npm test does, and owning all of them means owning the repository. The code owner boundary is the place where a change alters what a required check means, not every file the check reads.
Moving the check outside the repository removes the edit path. A workflow triggered by pull_request_target runs from the base repository's default branch, but GitHub warns against using it to build or run pull request code. On 2026-11-23 the same page also described a default policy that blocks the event in public repositories, then in evaluate mode, with enforcement announced for December 2, 2026 on repositories that were using that default before general availability (securely using pull_request_target). On GitHub Enterprise Cloud, an organization ruleset can require a workflow pinned to a commit in another repository (ruleset required workflows).
What it costs#
Every pull request that touches .github/ now waits for the CI owners, including routine ones. Dependabot updates to action versions in workflow files land in that queue, and so does a one-word fix to an issue template. If @acme/ci-platform is two people, they become a bottleneck. Narrow the pattern if template edits are frequent, for example by owning /.github/workflows/ and /.github/actions/ instead of all of /.github/, and keep the CODEOWNERS line separate.
The decision#
Treat any edit to the files a required check executes as a policy change. Give .github/workflows/, local actions, CODEOWNERS and the scripts your required jobs call an owning team, and require code owner review on protected branches. Ask that team to review workflow diffs as merge-policy diffs: what does each required check run after this change, and can it still fail?