Skip to content

Commit

Permalink
feat: no retry, in with
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangciwu committed Dec 8, 2022
1 parent b2cfbd1 commit 073a721
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ with:
channel: app-alerts
status: STARTED
color: good
noRetry: true
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }}
SLACK_NO_RETRY: true
```
The Slack notification leverages attachments to group important information together and provide valuable links:
Expand All @@ -25,6 +25,8 @@ When used with the `pull_request` event, a link to the originating pull request

<img src="docs/pr.png" alt="Screenshot of the pull_request event" width="540">

If you want no retry for slack client, you can indicate with `noRetry: true` in `with` (if not, it's `tenRetriesInAboutThirtyMinutes` by default, you can check doc in [slack web api](https://www.npmjs.com/package/@slack/web-api))

### Updating an Existing Message

If you need to send multiple Slack build updates and you prefer to update a single message instead of posting multiple messages, you can pass a `message_id` to future steps.
Expand Down
4 changes: 2 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ const { buildSlackAttachments, formatChannelName } = __webpack_require__(543);
const color = core.getInput('color');
const messageId = core.getInput('message_id');
const token = process.env.SLACK_BOT_TOKEN;
const noRetry = process.env.SLACK_NO_RETRY;
const noRetry = core.getInput('noRetry');
const slack = new WebClient(token, noRetry ? {retryConfig: {retries: 0}} : undefined);

if (!channel && !core.getInput('channel_id')) {
Expand Down Expand Up @@ -18434,4 +18434,4 @@ RetryOperation.prototype.mainError = function() {

/***/ })

/******/ });
/******/ });
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const { buildSlackAttachments, formatChannelName } = require('./src/utils');
const color = core.getInput('color');
const messageId = core.getInput('message_id');
const token = process.env.SLACK_BOT_TOKEN;
const slack = new WebClient(token);
const noRetry = core.getInput('noRetry');
const slack = new WebClient(token, noRetry ? { retryConfig: { retries: 0 } } : undefined);

if (!channel && !core.getInput('channel_id')) {
core.setFailed(`You must provider either a 'channel' or a 'channel_id'.`);
Expand Down

0 comments on commit 073a721

Please sign in to comment.