`gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable.`
BeginnerTroubleshootingPermissions, Tokens & Secrets
Answer
Likely causes → gh does not pick up the token automatically.
Diagnose → Check the step's env.
Fix →
- run: gh pr comment "$PR" --body "Deployed"
env:
GH_TOKEN: ${{ github.token }}
PR: ${{ github.event.pull_request.number }}
Prevent → Set GH_TOKEN at job level in workflows that use gh heavily.
More on Permissions, Tokens & Secrets
`Error: Resource not accessible by integration` when a workflow tries to comment on a PR.Beginner`remote: Permission to devopsshack/shack-api.git denied to github-actions[bot]. fatal: unable to access 'https://github.com/devopsshack/shack-api/': The requested URL returned error: 403`Beginner`fatal: could not read Username for 'https://github.com': terminal prompts disabled` when cloning a second private repo.BeginnerA secret is empty in the workflow even though it is set in Settings.Beginner`Error: Input required and not supplied: token` on a fork PR.BeginnerReleases created by a workflow do not trigger the `on: release` deploy workflow.Intermediate