diff --git a/.github/broken-link-checker/src/index.ts b/.github/broken-link-checker/src/index.ts index 124820f92d..bc09696c8b 100644 --- a/.github/broken-link-checker/src/index.ts +++ b/.github/broken-link-checker/src/index.ts @@ -80,17 +80,24 @@ const postComment = async (outputMd: string) => { const { context, getOctokit } = github const octokit = getOctokit(process.env.GITHUB_TOKEN!) const { owner, repo } = context.repo - const pullRequest = context.payload.pull_request - if (!pullRequest) { - console.log("Skipping since this is not a pull request") - process.exit(0) - } - const isFork = pullRequest.head.repo.fork - const prNumber = pullRequest.number - if (isFork) { - setFailed( - "The action could not create a GitHub comment because it is initiated from a forked repo. View the action logs for a list of broken links." - ) + console.log("CONTEXT", context.payload) + // const pullRequest = context.payload.pull_request + // if (!pullRequest) { + // console.log("Skipping since this is not a pull request") + // process.exit(0) + // } + // const isFork = pullRequest.head.repo.fork + // const prNumber = pullRequest.number + // if (isFork) { + // setFailed( + // "The action could not create a GitHub comment because it is initiated from a forked repo. View the action logs for a list of broken links." + // ) + // return "" + // } + // + const prNumber = context.payload?.issue?.number + if (!prNumber) { + setFailed("Count not find PR Number") return "" } @@ -157,9 +164,8 @@ const generateOutputMd = (output: Output): string => { // @ts-expect-error links.forEach((link: TODO) => { - outputMd += `| [${new URL(link.url.resolved).pathname}](${ - link.url.resolved - }) | "${link.html?.text?.trim().replaceAll("\n", "")}" | + outputMd += `| [${new URL(link.url.resolved).pathname}](${link.url.resolved + }) | "${link.html?.text?.trim().replaceAll("\n", "")}" | ` }) })