Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: skip ci failure slack notifications for renovate branches #24692

Merged
Merged
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
18 changes: 17 additions & 1 deletion scripts/circleci/notify-slack-job-failure.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,35 @@
* will be a noop when running for forked builds (i.e. PRs).
*/

const {
isVersionBranch,
getConfig,
assertValidGithubConfig,
} = require('@angular/dev-infra-private/ng-dev');

if (process.env.CIRCLE_PR_NUMBER) {
console.info('Skipping notifications for pull requests.');
process.exit(0);
}

const {echo, set} = require('shelljs');
const {
CIRCLE_JOB: jobName,
CIRCLE_BRANCH: branchName,
CIRCLE_BUILD_URL: jobUrl,
SLACK_COMPONENTS_CI_FAILURES_WEBHOOK_URL: webhookUrl,
} = process.env;

const {github} = getConfig([assertValidGithubConfig]);
const isPublishBranch = isVersionBranch(branchName) || branchName === github.mainBranchName;

// We don't want to spam the CI failures channel with e.g. Renovate branch failures.
if (isPublishBranch === false) {
console.info('Skipping notifications for non-publish branches.');
process.exit(0);
}

const {echo, set} = require('shelljs');

const text = `\`${jobName}\` failed in branch: ${branchName}: ${jobUrl}`;
const payload = {text};
const [channelName] = process.argv.slice(2);
Expand Down