GitHub Actions: secret is empty on pull_request from a fork or Dependabot (Secrets are not passed to workflows triggered by a fork)
Secrets are intentionally withheld from workflows that run for pull requests from forks and, by default, for Dependabot PRs — so ${{ secrets.X }} is an empty string.
Secrets are not passed to workflows that are triggered by a pull request from a forksecrets are empty on pull_request from forkDependabot cannot access secretssecrets not available in fork pull requestResource not accessible by integration fork Meaning
This protects your secrets from untrusted code. Steps that need a secret then fail with "Input required and not supplied" or an authentication error. Run secret-free checks on pull_request, and use pull_request_target or workflow_run only with great care (never check out and run untrusted PR code with secrets).
Common causes
- PR opened from a fork (secrets and write token are not provided)
- Dependabot-triggered run using Actions secrets instead of Dependabot secrets
- Secret defined at the wrong level (environment vs repository)
- Secret name misspelled
- Environment protection rules not met
⚡ Quick fix
- Keep untrusted PR jobs secret-free (build and test only)
- Add the secrets under Settings → Secrets → Dependabot for Dependabot PRs
- Use
workflow_run/pull_request_targetwith a hardened design if you must comment or publish
Detailed fix by platform
GitHub Actions
- Fork-safe pattern: build on
pull_request, upload an artifact, then a separateworkflow_runjob (with secrets) reads the artifact data but never executes it
Code examples
Skip secret steps for forks
- name: Deploy preview
if: github.event.pull_request.head.repo.full_name == github.repository # not from a fork
env:
TOKEN: ${{ secrets.PREVIEW_TOKEN }}
run: ./preview.shHow to diagnose
- Origin — Is the PR from a fork or Dependabot?
- Level — Where is the secret defined?
- Needs — Does the step really require a secret?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- API rate limit exceeded GitHub Actions: HttpError: API rate limit exceeded for installation ID 123456 / secondary rate limit
- Context access might be invalid GitHub Actions: Context access might be invalid: AWS_ACCESS_KEY_ID (editor warning for secrets/vars)
- Credentials could not be loaded GitHub Actions: Error: Credentials could not be loaded, please check your action inputs: Could not load credentials from any providers
Most viewed in CI/CD
- The process '/usr/bin/git' failed with exit code 128 GitHub Actions: Error: The process '/usr/bin/git' failed with exit code 128
- This job is stuck because you don't have any active runners GitLab CI: This job is stuck because you don't have any active runners online or available with any of these tags assigned to them
- ComparisonError: manifest generation failed Argo CD: ComparisonError: rpc error: code = Unknown desc = Manifest generation error (cached): kustomize build failed
Other ways to find it
Where this error sits
Origin: Build & delivery. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 25 Oct 2026