{"record":{"id":"30e69d31598f43a6","repo":"affaan-m/ECC","slug":"github-repository-configuration-is-missing","errorCode":null,"errorMessage":"GitHub repository configuration is missing","messagePattern":"GitHub repository configuration is missing","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/discord/release-announce.mjs","lineNumber":203,"sourceCode":"  const recent = await discord('GET', `/channels/${env.DISCORD_ANNOUNCE_CHANNEL_ID}/messages?limit=100`);\n  const receipt = findDiscordReceipt(recent, key);\n  if (receipt) {\n    await discord('PUT', `/channels/${env.DISCORD_ANNOUNCE_CHANNEL_ID}/pins/${receipt.id}`);\n    console.log('announcement already delivered; pin verified');\n    return;\n  }\n  const message = await discord('POST', `/channels/${env.DISCORD_ANNOUNCE_CHANNEL_ID}/messages`, buildDiscordPayload({\n    title: discussion.title,\n    body: discussion.body,\n    url: discussion.url,\n    key,\n  }));\n  await discord('PUT', `/channels/${env.DISCORD_ANNOUNCE_CHANNEL_ID}/pins/${message.id}`);\n  console.log('announcement delivered and pinned');\n}\n\nasync function main() {\n  if (!env.GITHUB_REPOSITORY) throw new Error('GitHub repository configuration is missing');\n  if ((env.ANNOUNCEMENT_KIND === 'release' || env.ANNOUNCEMENT_KIND === 'manual') && !env.GITHUB_TOKEN) throw new Error('GitHub configuration is missing');\n  const discussion = env.ANNOUNCEMENT_KIND === 'release'\n    ? await createOrFindReleaseDiscussion()\n    : env.ANNOUNCEMENT_KIND === 'manual'\n      ? await discussionFromGitHub()\n      : discussionFromEnvironment();\n  await deliver(discussion);\n}\n\nmain().catch(error => {\n  console.error(`release-announce failed: ${error.message}`);\n  process.exitCode = 1;\n});\n","sourceCodeStart":185,"sourceCodeEnd":217,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/discord/release-announce.mjs#L185-L217","documentation":"main() validates required environment before any delivery work. GITHUB_REPOSITORY (owner/repo) is needed to build the announcement key and locate or create the GitHub discussion. When absent, the script throws immediately.","triggerScenarios":"main() runs with env.GITHUB_REPOSITORY undefined — e.g. the script executed outside GitHub Actions or with GITHUB_REPOSITORY not forwarded.","commonSituations":"Running scripts/discord/release-announce.mjs locally without exporting GITHUB_REPOSITORY; a non-GitHub CI where the variable is not auto-provided; calling the script through a wrapper that sanitizes env.","solutions":["Run inside a GitHub Actions workflow where GITHUB_REPOSITORY is set automatically","Locally: export GITHUB_REPOSITORY=owner/repo before running","In custom CI, explicitly set GITHUB_REPOSITORY in the job environment"],"exampleFix":"// before\nnode scripts/discord/release-announce.mjs\n// after\nGITHUB_REPOSITORY=affaan-m/ECC node scripts/discord/release-announce.mjs","handlingStrategy":"validation","validationCode":"if (!process.env.GITHUB_REPOSITORY) throw new Error('GITHUB_REPOSITORY must be set (owner/repo)');","typeGuard":"const hasRepo = (env) => typeof env.GITHUB_REPOSITORY === 'string' && /^[^/]+\\/[^/]+$/.test(env.GITHUB_REPOSITORY);","tryCatchPattern":"try { await main(); } catch (e) { if (/repository configuration is missing/.test(e.message)) { console.error('Run inside GitHub Actions or export GITHUB_REPOSITORY=owner/repo'); process.exit(1); } throw e; }","preventionTips":["Prefer running via GitHub Actions where GITHUB_REPOSITORY is automatic","For local runs, export GITHUB_REPOSITORY before invoking the script","Add an env preflight step to CI that fails fast on missing vars"],"tags":["github","configuration","env"],"backgroundTag":"missing-required-config-field","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}