Skip to content

Commit 4fe4209

Browse files
committed
Add a high impact slack webhook
1 parent 533b3c7 commit 4fe4209

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

.github/workflows/helpers.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ Then run: node --env-file=.env .github/workflows/update-ims.js`);
2222
};
2323
};
2424

25-
const slackNotification = (text) => {
25+
const slackNotification = (text, webhook) => {
2626
console.log(text);
27-
return fetch(process.env.MILO_RELEASE_SLACK_WH, {
27+
return fetch(webhook || process.env.MILO_RELEASE_SLACK_WH, {
2828
method: 'POST',
2929
headers: {
3030
'Content-Type': 'application/json',

.github/workflows/merge-to-stage.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ const RCPDates = [
8585
];
8686

8787
const isHighPrio = (labels) => labels.includes(LABELS.highPriority);
88-
const isHighImpact = (labels) => labels.includes(LABELS.highImpact);
8988

9089
const hasFailingChecks = (checks) =>
9190
checks.some(
@@ -138,12 +137,19 @@ const merge = async ({ prs }) => {
138137
if (!process.env.LOCAL_RUN)
139138
await github.rest.pulls.merge({ owner, repo, pull_number: number });
140139
body = `- [${title}](${html_url})\n${body}`;
140+
const isHighImpact = labels.includes(LABELS.highImpact);
141+
if (isHighImpact && process.env.SLACK_HIGH_IMPACT_PR_WEBHOOK) {
142+
await slackNotification(
143+
SLACK.merge({ html_url, number, title, highImpact: ' :alert:' }),
144+
process.env.SLACK_HIGH_IMPACT_PR_WEBHOOK
145+
);
146+
}
141147
await slackNotification(
142148
SLACK.merge({
143149
html_url,
144150
number,
145151
title,
146-
highImpact: isHighImpact(labels) ? ' :alert:' : '',
152+
highImpact: isHighImpact ? ' :alert:' : '',
147153
})
148154
);
149155
}

.github/workflows/merge-to-stage.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
env:
1111
MILO_RELEASE_SLACK_WH: ${{ secrets.MILO_RELEASE_SLACK_WH }}
1212
REQUIRED_APPROVALS: ${{ secrets.REQUIRED_APPROVALS }}
13+
SLACK_HIGH_IMPACT_PR_WEBHOOK: ${{ secrets.SLACK_HIGH_IMPACT_PR_WEBHOOK }}
1314

1415
jobs:
1516
merge-to-stage:

0 commit comments

Comments
 (0)