Interview Prep/Git & GitHub/Remotes, Collaboration and Pull Requests

An outside contributor's PR from a fork should run CI, but your workflow needs secrets.

AdvancedScenarioRemotes, Collaboration and Pull Requests
Answer

Situation read → Secrets are not passed to workflows triggered by fork PRs, for good reason: the fork's code is untrusted.

What I'd do →

  1. Keep pull_request for tests that need no secrets. Fork PRs get a read-only token.
  2. For label or comment automation, use pull_request_target only if you never check out or run PR code with it.
  3. Require approval for first-time contributors (Settings → Actions → Fork pull request workflows).
  4. For real integration tests, a maintainer pushes the contributor's commit to a branch in the main repo after review.

Why → pull_request_target runs in the base repo's context with secrets. Running untrusted code there is a well-known compromise path.

Interview tip → Name "pwn request" as the risk. It signals real security awareness.

All Git & GitHub questions Roadmap: Git & GitHub

More on Remotes, Collaboration and Pull Requests