affaan-m/ECC · error · Error

GitHub repository configuration is missing

Error message

GitHub repository configuration is missing

What it means

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.

Solutions

  1. Run inside a GitHub Actions workflow where GITHUB_REPOSITORY is set automatically
  2. Locally: export GITHUB_REPOSITORY=owner/repo before running
  3. In custom CI, explicitly set GITHUB_REPOSITORY in the job environment

Example fix

// before
node scripts/discord/release-announce.mjs
// after
GITHUB_REPOSITORY=affaan-m/ECC node scripts/discord/release-announce.mjs
Defensive patterns

Strategy: validation

Validate before calling

if (!process.env.GITHUB_REPOSITORY) throw new Error('GITHUB_REPOSITORY must be set (owner/repo)');

Type guard

const hasRepo = (env) => typeof env.GITHUB_REPOSITORY === 'string' && /^[^/]+\/[^/]+$/.test(env.GITHUB_REPOSITORY);

Try / catch

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; }

Prevention

When it happens

Trigger: main() runs with env.GITHUB_REPOSITORY undefined — e.g. the script executed outside GitHub Actions or with GITHUB_REPOSITORY not forwarded.

Common situations: 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.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/30e69d31598f43a6. Report an issue: GitHub.

Appendix: source

Thrown at scripts/discord/release-announce.mjs:203

  const recent = await discord('GET', `/channels/${env.DISCORD_ANNOUNCE_CHANNEL_ID}/messages?limit=100`);
  const receipt = findDiscordReceipt(recent, key);
  if (receipt) {
    await discord('PUT', `/channels/${env.DISCORD_ANNOUNCE_CHANNEL_ID}/pins/${receipt.id}`);
    console.log('announcement already delivered; pin verified');
    return;
  }
  const message = await discord('POST', `/channels/${env.DISCORD_ANNOUNCE_CHANNEL_ID}/messages`, buildDiscordPayload({
    title: discussion.title,
    body: discussion.body,
    url: discussion.url,
    key,
  }));
  await discord('PUT', `/channels/${env.DISCORD_ANNOUNCE_CHANNEL_ID}/pins/${message.id}`);
  console.log('announcement delivered and pinned');
}

async function main() {
  if (!env.GITHUB_REPOSITORY) throw new Error('GitHub repository configuration is missing');
  if ((env.ANNOUNCEMENT_KIND === 'release' || env.ANNOUNCEMENT_KIND === 'manual') && !env.GITHUB_TOKEN) throw new Error('GitHub configuration is missing');
  const discussion = env.ANNOUNCEMENT_KIND === 'release'
    ? await createOrFindReleaseDiscussion()
    : env.ANNOUNCEMENT_KIND === 'manual'
      ? await discussionFromGitHub()
      : discussionFromEnvironment();
  await deliver(discussion);
}

main().catch(error => {
  console.error(`release-announce failed: ${error.message}`);
  process.exitCode = 1;
});

View on GitHub (pinned to 8321021c54)