Your GitHub Actions workflow works on your branch, then fails on a pull request with an empty value:
Error: Input required and not supplied: token or an API key that is just blank.
Why secrets are empty
- The PR comes from a fork. GitHub does not pass repository secrets to workflows triggered by pull requests from forks. This is deliberate.
- Secret name typo.
secrets.SUPABASE_KEYandsecrets.SUPABASE_ANON_KEYare different. A missing secret is an empty string, not an error. - Wrong scope. The secret is set on an environment, but the job does not declare
environment:. Or it is set on another repo. - Dependabot. Dependabot PRs use a separate secrets store.
- Reusable workflow. Secrets must be passed in with
secrets:orsecrets: inherit. - Used in an
if:condition. Secrets cannot be read directly there. Map to an env var first.
The unsafe fix
The tempting fix for cause 1 is to switch the trigger to pull_request_target, which does give secrets to the run. If that workflow then checks out and runs code from the PR, a stranger's pull request can run code with your secrets and a write token. This is a well known way repository secrets get stolen.
Other unsafe fixes:
- Printing the secret with
echoto see if it is set. Logs can be read, and masking is not perfect once a value is transformed. - Hardcoding the key in the workflow file or committing a
.env. - Passing the secret into a build that outputs it into your public JavaScript bundle.
The safe pattern
- Keep
pull_requestfor untrusted code. Run tests that need no secrets. - Run secret-using steps only on pushes to your protected branch, or behind a required-reviewer environment.
- Give the workflow the least permissions: set
permissions:explicitly. - Rotate any key that was ever echoed or committed.
An outside view
ProofForge at proofforge.live runs a free public-side scan of AI-built apps. It never signs in, so it checks what a visitor can see on the live site, such as secret-shaped strings in the shipped bundle, which is where a leaky build step ends up. It cannot see your workflow files or repository settings.
