Skip to content

Commit 38496d3

Browse files
committed
build: replace dynamic require with import statement for ESM
Follow-up to: #25062. (cherry picked from commit e07fa1e)
1 parent a11f20d commit 38496d3

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* will be a noop when running for forked builds (i.e. PRs).
66
*/
77

8+
import sh from 'shelljs';
89
import {
910
isVersionBranch,
1011
getConfig,
@@ -30,21 +31,19 @@ if (isPublishBranch === false) {
3031
process.exit(0);
3132
}
3233

33-
const {echo, set} = require('shelljs');
34-
3534
const text = `\`${jobName}\` failed in branch: ${branchName}: ${jobUrl}`;
3635
const payload: {text: string; channel?: string} = {text};
3736
const [channelName] = process.argv.slice(2);
3837

39-
set('-e');
38+
sh.set('-e');
4039

4140
// If an explicit channel has been specified, override the default
4241
// webhook channel to the specified one.
4342
if (channelName !== undefined) {
4443
payload.channel = channelName;
4544
}
4645

47-
echo(JSON.stringify(payload, null, 2)).exec(
46+
sh.echo(JSON.stringify(payload, null, 2)).exec(
4847
`curl -d@- -H "Content-Type: application/json" ${webhookUrl}`,
4948
);
5049
console.info('Notified Slack about job failure.');

0 commit comments

Comments
 (0)