GitHub Actions: secrets are empty in pull requests from forks
@devsingh05▲ 10 net votes
Workflows triggered by pull_request from a fork run without repository secrets (and with a read-only token) for safety, so steps needing API keys fail with auth errors or empty variables. Skip those steps when the secret is missing (if: env.MY_KEY != '' after mapping it into env), or run them on push to main only. pull_request_target exposes secrets but runs untrusted code risks; avoid checking out the PR's code in it.