Interview Prep/GitHub Actions/Permissions, Tokens & Secrets

A secret is empty in the workflow even though it is set in Settings.

BeginnerTroubleshootingPermissions, Tokens & Secrets
Answer

Likely causes → Fork PR or Dependabot run (no Actions secrets), the secret is an environment secret but the job has no environment, an org secret not shared with this repo, a name mismatch, or a reusable workflow that was not passed the secret.

Diagnose →

gh secret list; gh secret list --env prod; gh secret list --org devopsshack

and if [ -z "$X" ]; then echo "empty"; fi in a step.

Fix → Bind the job to the environment, share the org secret with the repo, pass secrets explicitly or with secrets: inherit.

Prevent → Fail early with a clear message when a required secret is empty.

All GitHub Actions questions Roadmap: GitHub Actions

More on Permissions, Tokens & Secrets