{"record":{"id":"c6957d0911004ed1","repo":"stablyai/orca","slug":"gh-token-or-github-token-must-be-set","errorCode":null,"errorMessage":"GH_TOKEN or GITHUB_TOKEN must be set","messagePattern":"GH_TOKEN or GITHUB_TOKEN must be set","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/scripts/verify-release-required-assets.mjs","lineNumber":151,"sourceCode":"    )\n  }\n\n  return {\n    tag,\n    checked: [...requiredNames].sort(),\n    draft: release.draft,\n    prerelease: release.prerelease\n  }\n}\n\nasync function main() {\n  const tag = process.argv[2]\n  if (!tag) {\n    throw new Error('Usage: node config/scripts/verify-release-required-assets.mjs <tag>')\n  }\n  const token = process.env.GH_TOKEN || process.env.GITHUB_TOKEN\n  if (!token) {\n    throw new Error('GH_TOKEN or GITHUB_TOKEN must be set')\n  }\n  const repo = process.env.GITHUB_REPOSITORY || 'stablyai/orca'\n  const result = await verifyRequiredReleaseAssets({ repo, tag, token })\n  console.log(`Verified ${result.checked.length} required release assets for ${repo}@${tag}`)\n}\n\nif (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {\n  main().catch((error) => {\n    console.error(error.message)\n    process.exit(1)\n  })\n}\n","sourceCodeStart":133,"sourceCodeEnd":164,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/verify-release-required-assets.mjs#L133-L164","documentation":"Usage guard in main(): the script needs a GitHub auth token to call the releases API. It checks GH_TOKEN then falls back to GITHUB_TOKEN; if neither env var is set it aborts before any network call.","triggerScenarios":"Running locally without exporting a token; CI job whose permissions block omits contents:read or that doesn't forward the auto-generated GITHUB_TOKEN; invoking in a container or shell that strips the environment.","commonSituations":"Local developer machine with no gh auth or token export; reusable workflow that doesn't propagate secrets; scheduled run on a fork without a PAT; runner env reset between steps.","solutions":["Export a token locally: export GH_TOKEN=$(gh auth token) or set a PAT with repo read scope.","In GitHub Actions, ensure the job has permissions: contents: read and that GITHUB_TOKEN is available (it is injected automatically unless overridden).","If using a reusable workflow, pass the token explicitly via env or secrets.","Verify the env var is actually exported in the shell invoking node (printenv GH_TOKEN)."],"exampleFix":"# before\nnode config/scripts/verify-release-required-assets.mjs v1.2.3\n# after\nexport GH_TOKEN=\"${{ secrets.GITHUB_TOKEN }}\"\nnode config/scripts/verify-release-required-assets.mjs v1.2.3","handlingStrategy":"validation","validationCode":"# Before running, assert the token env exists:\n# - name: Verify release assets\n#   env:\n#     GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n#   run: |\n#     [ -n \"$GH_TOKEN\" ] || { echo 'missing token'; exit 2; }\n#     node config/scripts/verify-release-required-assets.mjs \"$TAG\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set permissions: contents: read on the job so GITHUB_TOKEN is injected.","For reusable workflows, pass the token via env or secrets explicitly.","Prefer GH_TOKEN naming consistently to avoid fallback confusion."],"tags":["auth","github-token","ci-gate","environment"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}