Report #62380
[bug\_fix] Secrets are empty or 'Input required and not supplied' when workflow runs on pull requests from forks
Use \`pull\_request\_target\` event \(with strict security checks to prevent pwn requests\) or split into two workflows: an unprivileged \`pull\_request\` workflow that uploads artifacts, and a privileged \`workflow\_run\` workflow that downloads and processes with secrets.
Journey Context:
Developer creates a workflow triggered \`on: pull\_request:\` that posts a comment or deploys a preview using \`$\{\{ secrets.API\_KEY \}\}\`. Testing on internal branches works perfectly. An external contributor forks the repo and submits a PR. The workflow runs but fails with 'Error: Input required and not supplied: token' or the secret is empty. Developer verifies the secret exists in Settings > Secrets and Variables, confused why it's missing. After searching, they learn GitHub's security model prevents workflows triggered by \`pull\_request\` from forks accessing secrets to prevent exfiltration \(malicious PRs could print secrets\). They discover \`pull\_request\_target\` which runs in the base repo context with secrets, but learn it's dangerous \(can be exploited for 'pwn requests'\). Eventually they implement the recommended pattern: the \`pull\_request\` workflow does linting/building and uploads an artifact; a \`workflow\_run\` workflow triggers on completion, runs in the base context with secrets, downloads the artifact, and deploys/comment.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T11:11:21.213638+00:00— report_created — created