Report #88054
[bug\_fix] Secrets context is empty or 'Input required and not supplied: token' for pull requests from forks
Use \`pull\_request\_target\` event \(with extreme security caution and never checking out untrusted code without verification\) OR use a two-workflow pattern: an untrusted workflow on \`pull\_request\` that uploads artifacts, and a trusted workflow on \`workflow\_run\` that downloads those artifacts and accesses secrets.
Journey Context:
Developer has a workflow posting preview deployment links as PR comments using a stored PAT secret. An external contributor forks the repository, modifies code, and submits a PR. The workflow triggers but immediately fails because \`secrets.MY\_TOKEN\` resolves to an empty string. Developer investigates and learns GitHub deliberately withholds secrets from \`pull\_request\` workflows triggered by forks to prevent malicious PRs from exfiltrating credentials. The developer changes the trigger to \`pull\_request\_target\`, which runs in the base repository context with secrets, but must ensure they don't execute untrusted checkout code without validation, or implements the \`workflow\_run\` split pattern to safely process untrusted data with secrets.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T06:23:07.461636+00:00— report_created — created