diff --git a/dist/index.js b/dist/index.js index 428278a..756672c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -7166,8 +7166,13 @@ async function parseCommitMessage(message, repoUrl, fetchUserFunc) { const found = cAst.subject.match(PR_REGEX); if (found) { const pullNumber = found[1]; - const { username, userUrl } = await fetchUserFunc(pullNumber); - cAst.subject = cAst.subject.replace(PR_REGEX, () => `[#${pullNumber}](${repoUrl}/pull/${pullNumber}) by [${username}](${userUrl})`); + + try { + const { username, userUrl } = await fetchUserFunc(pullNumber); + cAst.subject = cAst.subject.replace(PR_REGEX, () => `[#${pullNumber}](${repoUrl}/pull/${pullNumber}) by [${username}](${userUrl})`); + } catch (error) { + // We found a #123 style hash, but it wasn't a valid PR. Ignore. + } } return cAst; diff --git a/src/parseCommitMessage.js b/src/parseCommitMessage.js index 67192c6..067d521 100644 --- a/src/parseCommitMessage.js +++ b/src/parseCommitMessage.js @@ -19,8 +19,13 @@ async function parseCommitMessage(message, repoUrl, fetchUserFunc) { const found = cAst.subject.match(PR_REGEX); if (found) { const pullNumber = found[1]; - const { username, userUrl } = await fetchUserFunc(pullNumber); - cAst.subject = cAst.subject.replace(PR_REGEX, () => `[#${pullNumber}](${repoUrl}/pull/${pullNumber}) by [${username}](${userUrl})`); + + try { + const { username, userUrl } = await fetchUserFunc(pullNumber); + cAst.subject = cAst.subject.replace(PR_REGEX, () => `[#${pullNumber}](${repoUrl}/pull/${pullNumber}) by [${username}](${userUrl})`); + } catch (error) { + // We found a #123 style hash, but it wasn't a valid PR. Ignore. + } } return cAst;