Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async function resolveAllComments(context, prNumber) {
)

for (const comment of comments) {
if (comment.user.login !== 'cursor[bot]' || comment.user.login !== 'snyk-io[bot]') continue;
if (comment.user.login !== 'cursor[bot]' && comment.user.login !== 'snyk-io[bot]') continue;
console.log("deleting comment : " + comment.id);
await context.octokit.request(
'DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}',
Expand Down
16 changes: 13 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async function resolveAllComments(context, prNumber) {
)

for (const comment of comments) {
if (comment.user.login !== 'cursor[bot]' || comment.user.login !== 'snyk-io[bot]') continue;
if (comment.user.login !== 'cursor[bot]' && comment.user.login !== 'snyk-io[bot]') continue;
console.log("deleting comment : " + comment.id);
await context.octokit.request(
'DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}',
Expand Down Expand Up @@ -193,6 +193,7 @@ exports.masterBranch = masterBranch;
const notifications = __nccwpck_require__(53474);
const github = __nccwpck_require__(76898);
const core = __nccwpck_require__(42186);
const slack = __nccwpck_require__(38154);
const { masterBranch } = __nccwpck_require__(51629);

function toPr(context) {
Expand Down Expand Up @@ -327,6 +328,7 @@ async function raisePrToAllStagingBranches(context, onMergeConflict) {
try {
let stagingBranchNames = await fetchingStagingBranchNames(context)
console.log(`Raising PR to all staging branches - ${stagingBranchNames.join(", ")}`)
throw new Error("Throwing a dummy error")
return stagingBranchNames.map(async (branchName) => {
let existingOpenPr = await github.fetchOpenPr(context, masterBranch, branchName);
if (existingOpenPr) {
Expand All @@ -341,8 +343,9 @@ async function raisePrToAllStagingBranches(context, onMergeConflict) {
return createdPr
})
} catch(err) {
console.log("ERROR!")
console.log(err)
slack.autoSyncFailed("master");
throw err;
}
}

Expand Down Expand Up @@ -108038,7 +108041,14 @@ async function notifyPrMergeFailed(pr) {
slack.markdown(`Team <!here>, fix it by merging <${pr.url}|this PR> *manually*.`)
])
}
module.exports = {notifyNewPR, notifyMergedPR, notifyClosedPR, notifyPrHasConflicts, notifyPrMergeFailed}

async function autoSyncFailed(channelName) {
let textMessage = `AUTO SYNC FAILED`
await slack.sendMessage(channelName, textMessage, [
slack.header(":need_action: AUTO SYNC FAILED :need_action:")
])
}
module.exports = {notifyNewPR, notifyMergedPR, notifyClosedPR, notifyPrHasConflicts, notifyPrMergeFailed, autoSyncFailed}

/***/ }),

Expand Down
5 changes: 4 additions & 1 deletion handlers/pr.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const notifications = require("./../notifications/pr");
const github = require("./../apps/github");
const core = require('@actions/core');
const slack = require("../notifications/slack");
const { masterBranch } = require("../constants");

function toPr(context) {
Expand Down Expand Up @@ -135,6 +136,7 @@ async function raisePrToAllStagingBranches(context, onMergeConflict) {
try {
let stagingBranchNames = await fetchingStagingBranchNames(context)
console.log(`Raising PR to all staging branches - ${stagingBranchNames.join(", ")}`)
throw new Error("Throwing a dummy error")
return stagingBranchNames.map(async (branchName) => {
let existingOpenPr = await github.fetchOpenPr(context, masterBranch, branchName);
if (existingOpenPr) {
Expand All @@ -149,8 +151,9 @@ async function raisePrToAllStagingBranches(context, onMergeConflict) {
return createdPr
})
} catch(err) {
console.log("ERROR!")
console.log(err)
slack.autoSyncFailed("master");
throw err;
}
}

Expand Down
9 changes: 8 additions & 1 deletion notifications/slack.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,11 @@ async function notifyPrMergeFailed(pr) {
slack.markdown(`Team <!here>, fix it by merging <${pr.url}|this PR> *manually*.`)
])
}
module.exports = {notifyNewPR, notifyMergedPR, notifyClosedPR, notifyPrHasConflicts, notifyPrMergeFailed}

async function autoSyncFailed(channelName) {
let textMessage = `AUTO SYNC FAILED`
await slack.sendMessage(channelName, textMessage, [
slack.header(":need_action: AUTO SYNC FAILED :need_action:")
])
}
module.exports = {notifyNewPR, notifyMergedPR, notifyClosedPR, notifyPrHasConflicts, notifyPrMergeFailed, autoSyncFailed}