Skip to content

Commit 9cb96aa

Browse files
authored
ci: skip ci failure slack notifications for renovate branches (#24692)
We want to skip CI failure Slack notifications for upstream branches which are not actual publish branches. Please enter the commit message for your changes. Lines starting
1 parent 460b25c commit 9cb96aa

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

scripts/circleci/notify-slack-job-failure.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,35 @@
55
* will be a noop when running for forked builds (i.e. PRs).
66
*/
77

8+
const {
9+
isVersionBranch,
10+
getConfig,
11+
assertValidGithubConfig,
12+
} = require('@angular/dev-infra-private/ng-dev');
13+
814
if (process.env.CIRCLE_PR_NUMBER) {
915
console.info('Skipping notifications for pull requests.');
1016
process.exit(0);
1117
}
1218

13-
const {echo, set} = require('shelljs');
1419
const {
1520
CIRCLE_JOB: jobName,
1621
CIRCLE_BRANCH: branchName,
1722
CIRCLE_BUILD_URL: jobUrl,
1823
SLACK_COMPONENTS_CI_FAILURES_WEBHOOK_URL: webhookUrl,
1924
} = process.env;
2025

26+
const {github} = getConfig([assertValidGithubConfig]);
27+
const isPublishBranch = isVersionBranch(branchName) || branchName === github.mainBranchName;
28+
29+
// We don't want to spam the CI failures channel with e.g. Renovate branch failures.
30+
if (isPublishBranch === false) {
31+
console.info('Skipping notifications for non-publish branches.');
32+
process.exit(0);
33+
}
34+
35+
const {echo, set} = require('shelljs');
36+
2137
const text = `\`${jobName}\` failed in branch: ${branchName}: ${jobUrl}`;
2238
const payload = {text};
2339
const [channelName] = process.argv.slice(2);

0 commit comments

Comments
 (0)