Report #91815
[bug\_fix] Secrets are empty or 'Input required and not supplied' when running workflows on pull requests from forks
Use the workflow\_run event to trigger a privileged secondary workflow after the unprivileged pull\_request workflow completes, allowing the secondary workflow to access secrets in a trusted context while processing artifacts produced by the fork. Alternatively, use pull\_request\_target only if the workflow does not execute untrusted code from the PR.
Journey Context:
An external contributor submitted a PR from their fork. The CI workflow immediately failed with 'Error: Input required and not supplied: api-key' despite the secret being configured in the base repository. The same workflow works perfectly on branches within the repository. Investigation reveals that GitHub deliberately withholds secrets from pull\_request workflows triggered by forks to prevent malicious PRs from exfiltrating secrets. The initial attempt to use pull\_request\_target seemed to work but raised security concerns because checking out the PR code with that event allows arbitrary code execution with secret access. The robust solution implements a two-workflow pattern: the first workflow runs on pull\_request with no secrets, uploads test artifacts, and triggers; the second workflow runs on workflow\_run, has access to secrets, downloads the artifacts, and posts coverage comments or deploys previews.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T12:42:09.634695+00:00— report_created — created