Merge pull request #21 from 8398a7/feature/19
[#19] support for multiple user mentions
This commit is contained in:
Коммит
e79971a042
24
README.md
24
README.md
|
@ -13,18 +13,18 @@ See [action.yml](action.yml), [checkin.yml](.github/workflows/checkin.yml)
|
||||||
|
|
||||||
### with Parameters
|
### with Parameters
|
||||||
|
|
||||||
| key | value | default | description |
|
| key | value | default | description |
|
||||||
| ----------------- | ------------------------------------------------------------------------------------------------------ | --------------------- | ----------------------------------------------------------------------------------------------------------- |
|
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ----------------------------------------------------------------------------------------------------------- |
|
||||||
| status | 'success' or 'failure' or 'cancelled' or 'custom' | '' | Recommend<br />`${{ job.status }}`. |
|
| status | 'success' or 'failure' or 'cancelled' or 'custom' | '' | Recommend<br />`${{ job.status }}`. |
|
||||||
| text | any string | '' | You can add to text by specifying it. |
|
| text | any string | '' | You can add to text by specifying it. |
|
||||||
| author_name | any string | '8398a7@action-slack' | It can be overwritten by specifying. The job name is recommend. |
|
| author_name | any string | '8398a7@action-slack' | It can be overwritten by specifying. The job name is recommend. |
|
||||||
| mention | 'here' or 'channel' or [user_id](https://api.slack.com/reference/surfaces/formatting#mentioning-users) | '' | Always mention when specified. |
|
| mention | 'here' or 'channel' or [user_id](https://api.slack.com/reference/surfaces/formatting#mentioning-users) (e.g. `mention: user_id,user_id2`) | '' | Always mention when specified. |
|
||||||
| only_mention_fail | 'here' or 'channel' or [user_id](https://api.slack.com/reference/surfaces/formatting#mentioning-users) | '' | If specified, mention only on failure. |
|
| only_mention_fail | 'here' or 'channel' or [user_id](https://api.slack.com/reference/surfaces/formatting#mentioning-users) (e.g. `mention: user_id,user_id2`) | '' | If specified, mention only on failure. |
|
||||||
| payload | e.g. `{"text": "Custom Field Check", obj: 'LOWER CASE'.toLowerCase()}` | '' | Only available when status: custom. The payload format can pass javascript object. |
|
| payload | e.g. `{"text": "Custom Field Check", obj: 'LOWER CASE'.toLowerCase()}` | '' | Only available when status: custom. The payload format can pass javascript object. |
|
||||||
| username | Only legacy incoming webhook supported. | '' | override the legacy integration's default name. |
|
| username | Only legacy incoming webhook supported. | '' | override the legacy integration's default name. |
|
||||||
| icon_emoji | Only legacy incoming webhook supported. | '' | an [emoji code](https://www.webfx.com/tools/emoji-cheat-sheet/) string to use in place of the default icon. |
|
| icon_emoji | Only legacy incoming webhook supported. | '' | an [emoji code](https://www.webfx.com/tools/emoji-cheat-sheet/) string to use in place of the default icon. |
|
||||||
| icon_url | Only legacy incoming webhook supported. | '' | an icon image URL string to use in place of the default icon. |
|
| icon_url | Only legacy incoming webhook supported. | '' | an icon image URL string to use in place of the default icon. |
|
||||||
| channel | Only legacy incoming webhook supported. | '' | override the legacy integration's default channel. This should be an ID, such as `C8UJ12P4P`. |
|
| channel | Only legacy incoming webhook supported. | '' | override the legacy integration's default channel. This should be an ID, such as `C8UJ12P4P`. |
|
||||||
|
|
||||||
See here for `payload` reference or [Custom Notification](https://github.com/8398a7/action-slack#custom-notification).
|
See here for `payload` reference or [Custom Notification](https://github.com/8398a7/action-slack#custom-notification).
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,12 @@ export class Client {
|
||||||
if (groupMention.includes(mention)) {
|
if (groupMention.includes(mention)) {
|
||||||
return `<!${mention}> `;
|
return `<!${mention}> `;
|
||||||
} else if (mention !== '') {
|
} else if (mention !== '') {
|
||||||
return `<@${mention}> `;
|
return (
|
||||||
|
mention
|
||||||
|
.split(',')
|
||||||
|
.map(userId => `<@${userId}>`)
|
||||||
|
.join(' ') + ' '
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче