diff --git a/.github/workflows/stats.yml b/.github/workflows/stats.yml index 7a66134..326c49b 100644 --- a/.github/workflows/stats.yml +++ b/.github/workflows/stats.yml @@ -2,6 +2,8 @@ name: pkg.pr.new stats on: push: + branches: + - main jobs: stats: diff --git a/packages/backend/server/routes/publish.post.ts b/packages/backend/server/routes/publish.post.ts index 4dd87d7..ee8abff 100644 --- a/packages/backend/server/routes/publish.post.ts +++ b/packages/backend/server/routes/publish.post.ts @@ -254,25 +254,46 @@ export default eventHandler(async (event) => { }, ); } else { - await installation.request( - "POST /repos/{owner}/{repo}/issues/{issue_number}/comments", - { - owner: workflowData.owner, - repo: workflowData.repo, - issue_number: Number(workflowData.ref), - body: generatePullRequestPublishMessage( - origin, - templatesHtmlMap, - packagesWithoutPrefix, - workflowData, - compact, - onlyTemplates, - checkRunUrl, - packageManager, - comment === "update" ? "ref" : "sha", - ), - }, - ); + try { + await installation.request( + "POST /repos/{owner}/{repo}/issues/{issue_number}/comments", + { + owner: workflowData.owner, + repo: workflowData.repo, + issue_number: Number(workflowData.ref), + body: generatePullRequestPublishMessage( + origin, + templatesHtmlMap, + packagesWithoutPrefix, + workflowData, + compact, + onlyTemplates, + checkRunUrl, + packageManager, + comment === "update" ? "ref" : "sha", + ), + }, + ); + } catch (error) { + throw createError({ + statusCode: 500, + message: `Failed to create pull request comment. Details: + Error: ${error instanceof Error ? error.message : String(error)} + Context: + - Owner: ${workflowData.owner} + - Repo: ${workflowData.repo} + - Issue Number: ${Number(workflowData.ref)} + - Origin: ${origin} + - Templates: ${JSON.stringify(templatesHtmlMap)} + - Packages: ${packagesWithoutPrefix.join(', ')} + - Workflow Data: ${JSON.stringify(workflowData)} + - Compact: ${compact} + - Only Templates: ${onlyTemplates} + - Check Run URL: ${checkRunUrl} + - Package Manager: ${packageManager} + - Comment Type: ${comment === "update" ? "ref" : "sha"}`, + }); + } } } }