MCPcopy Create free account
hub / github.com/anomalyco/opencode-bench / resolveContentLink

Function resolveContentLink

scripts/discord-sample.ts:542–566  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

540}
541
542function resolveContentLink(): string | undefined {
543 const repository = process.env.GITHUB_REPOSITORY;
544 if (!repository) {
545 return undefined;
546 }
547
548 const serverUrl = process.env.GITHUB_SERVER_URL ?? "https://github.com";
549 const eventName = process.env.GITHUB_EVENT_NAME;
550
551 if (eventName === "pull_request") {
552 const ref = process.env.GITHUB_REF ?? "";
553 const match = ref.match(/^refs\/pull\/(\d+)\//);
554 if (match) {
555 const prNumber = match[1];
556 return `${serverUrl}/${repository}/pull/${prNumber}`;
557 }
558 }
559
560 const sha = process.env.GITHUB_SHA;
561 if (sha) {
562 return `${serverUrl}/${repository}/commit/${sha}`;
563 }
564
565 return undefined;
566}
567async function sendWebhook(
568 webhookUrl: string,
569 payload: unknown,

Callers 1

buildPayloadsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected