From 531c4121dfe0028e3df72c9a2acf071f9db9cff2 Mon Sep 17 00:00:00 2001 From: Nilesh Rathi Date: Mon, 19 Jan 2026 13:00:07 +0530 Subject: [PATCH 1/2] Add repoFullName to PR data and enhance Slack notifications with repo prefix --- handlers/pr.js | 8 ++++++-- notifications/slack.js | 9 +++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/handlers/pr.js b/handlers/pr.js index 8bc30d3..39e1793 100644 --- a/handlers/pr.js +++ b/handlers/pr.js @@ -6,6 +6,9 @@ const { masterBranch } = require("../constants"); function toPr(context) { let { base, body, user, html_url, title, number, head, id} = context.payload.pull_request + let repoFullName = (base && base.repo && base.repo.full_name) || + (head && head.repo && head.repo.full_name) || ""; + return { description: body, authorHandle: user.login, @@ -15,7 +18,8 @@ function toPr(context) { from: head.ref, to: base.ref, id: id, - typeOfChange: head.ref.split('/')[0] + typeOfChange: head.ref.split('/')[0], + repoFullName: repoFullName } } @@ -221,4 +225,4 @@ async function test() { // var closedPr = JSON.parse(fs.readFileSync('./../ops/dev/fakes/pr/close.json', 'utf8')); // await onPrClose({ payload: { pull_request: closedPr } }) -} \ No newline at end of file +} diff --git a/notifications/slack.js b/notifications/slack.js index 3a7060a..eb66eb9 100644 --- a/notifications/slack.js +++ b/notifications/slack.js @@ -37,6 +37,10 @@ function entry(label, value) { return slack.markdown(`*${label}:* ${value}`) } +function repoPrefix(pr) { + return pr && pr.repoFullName ? `[${pr.repoFullName}] ` : "" +} + async function notifyNewPR(pr) { if (isAuthoredByBot(pr.authorHandle)) { return; @@ -55,8 +59,9 @@ async function notifyNewPR(pr) { async function notifyMergedPR(pr, mergedBy) { let textMessage = `${mergedBy} has merged a PR ${pr.title}(${pr.url})` if (isAuthoredByBot(mergedBy)) { + let completedMessage = `${repoPrefix(pr)}${pr.title} - completed` await slack.sendMessage(channelName(pr), textMessage, [ - slack.markdown(pr.title + " - completed") + slack.markdown(completedMessage) ]); return } @@ -115,4 +120,4 @@ async function autoSyncFailed(channelName) { slack.header(":need_action: AUTO SYNC FAILED :need_action:") ]) } -module.exports = {notifyNewPR, notifyMergedPR, notifyClosedPR, notifyPrHasConflicts, notifyPrMergeFailed, autoSyncFailed} \ No newline at end of file +module.exports = {notifyNewPR, notifyMergedPR, notifyClosedPR, notifyPrHasConflicts, notifyPrMergeFailed, autoSyncFailed} From aa4cb31b86c507b7853ec5bfc820256d57a91b45 Mon Sep 17 00:00:00 2001 From: Nilesh Rathi Date: Mon, 19 Jan 2026 14:38:54 +0530 Subject: [PATCH 2/2] add dist --- dist/index.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 6e7cb4c..b28f8cf 100644 --- a/dist/index.js +++ b/dist/index.js @@ -198,6 +198,9 @@ const { masterBranch } = __nccwpck_require__(51629); function toPr(context) { let { base, body, user, html_url, title, number, head, id} = context.payload.pull_request + let repoFullName = (base && base.repo && base.repo.full_name) || + (head && head.repo && head.repo.full_name) || ""; + return { description: body, authorHandle: user.login, @@ -207,7 +210,8 @@ function toPr(context) { from: head.ref, to: base.ref, id: id, - typeOfChange: head.ref.split('/')[0] + typeOfChange: head.ref.split('/')[0], + repoFullName: repoFullName } } @@ -415,6 +419,7 @@ async function test() { // await onPrClose({ payload: { pull_request: closedPr } }) } + /***/ }), /***/ 87351: @@ -107969,6 +107974,10 @@ function entry(label, value) { return slack.markdown(`*${label}:* ${value}`) } +function repoPrefix(pr) { + return pr && pr.repoFullName ? `[${pr.repoFullName}] ` : "" +} + async function notifyNewPR(pr) { if (isAuthoredByBot(pr.authorHandle)) { return; @@ -107987,8 +107996,9 @@ async function notifyNewPR(pr) { async function notifyMergedPR(pr, mergedBy) { let textMessage = `${mergedBy} has merged a PR ${pr.title}(${pr.url})` if (isAuthoredByBot(mergedBy)) { + let completedMessage = `${repoPrefix(pr)}${pr.title} - completed` await slack.sendMessage(channelName(pr), textMessage, [ - slack.markdown(pr.title + " - completed") + slack.markdown(completedMessage) ]); return } @@ -108049,6 +108059,7 @@ async function autoSyncFailed(channelName) { } module.exports = {notifyNewPR, notifyMergedPR, notifyClosedPR, notifyPrHasConflicts, notifyPrMergeFailed, autoSyncFailed} + /***/ }), /***/ 22877: