fix: add GH_TOKEN preflight check to compliance-audit.sh#60
Merged
Conversation
Adds an early-exit preflight check at the top of main() that: 1. Fails fast with a clear error if GH_TOKEN is unset 2. Runs gh auth status to verify the token is valid before proceeding Previously, auth failures manifested deep in the script as cryptic gh CLI errors rather than a clear authentication failure. Note: the step-level GH_TOKEN env var in the workflow also needs to be added manually (cannot be done here due to workflow permissions). See issue #30 for the required one-line workflow change. Co-authored-by: don-petry <don-petry@users.noreply.github.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Adds an early-exit preflight check at the top of
main()inscripts/compliance-audit.shthat fails fast with clear, actionable error messages when authentication isn't configured correctly.Changes
scripts/compliance-audit.sh— added at the top ofmain():Previously, auth failures manifested deep in the script as cryptic
ghCLI errors rather than a clear authentication failure message.Required manual change (workflow file)
The Claude GitHub App lacks the
workflowspermission and cannot modify.github/workflows/. To fully resolve the root cause, apply this one-line change manually to.github/workflows/compliance-audit-and-improvement.yml:In the Run compliance audit step (job
audit), addGH_TOKENexplicitly at the step level:Also verify
ORG_SCORECARD_TOKENis set in Settings → Secrets withrepo+read:orgscopes.Closes #30
Generated with Claude Code