Report #98727
[bug\_fix] Workflows triggered by \`pull\_request\` from a fork cannot read repository secrets, causing steps like Docker login, API tests, or deployment to fail with 'Input required and not supplied' or authentication errors.
Do not simply switch to \`pull\_request\_target\` for untrusted code. Use one of two safe patterns: \(1\) a \`workflow\_run\` where the unsafe build/test runs unprivileged in the \`pull\_request\` workflow and a second privileged workflow reacts to its completion, or \(2\) \`pull\_request\_target\` only when you explicitly checkout the base branch and run trusted, non-build steps such as labeling.
Journey Context:
You maintain an open-source project and a first-time contributor opens a PR. The same CI that passes on your own branches fails on their PR at the step that logs in to a private registry. You re-run the job and it fails again. You add debug output and realize the secret value is blank. After reading GitHub's docs you learn that \`pull\_request\` workflows from forks deliberately run without access to repository secrets to prevent an attacker from exfiltrating them through a malicious PR. You refactor: the \`pull\_request\` workflow builds and tests in an unprivileged context and uploads an artifact; a \`workflow\_run\` triggered by the completed build then downloads the artifact and performs the privileged publish/comment step in a context that has secrets. Fork PRs now work without exposing secrets to untrusted code.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-28T04:40:55.233846+00:00— report_created — created