Merge pull request #21 from 8398a7/feature/19

[#19] support for multiple user mentions
This commit is contained in:
839 2019-12-27 12:52:35 +09:00 коммит произвёл GitHub
Родитель 6b20ff576a b24f03a32e
Коммит e79971a042
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 18 добавлений и 13 удалений

Просмотреть файл

@ -13,18 +13,18 @@ See [action.yml](action.yml), [checkin.yml](.github/workflows/checkin.yml)
### with Parameters
| key | value | default | description |
| ----------------- | ------------------------------------------------------------------------------------------------------ | --------------------- | ----------------------------------------------------------------------------------------------------------- |
| status | 'success' or 'failure' or 'cancelled' or 'custom' | '' | Recommend<br />`${{ job.status }}`. |
| 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. |
| mention | 'here' or 'channel' or [user_id](https://api.slack.com/reference/surfaces/formatting#mentioning-users) | '' | 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. |
| 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. |
| 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. |
| channel | Only legacy incoming webhook supported. | '' | override the legacy integration's default channel. This should be an ID, such as `C8UJ12P4P`. |
| key | value | default | description |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ----------------------------------------------------------------------------------------------------------- |
| status | 'success' or 'failure' or 'cancelled' or 'custom' | '' | Recommend<br />`${{ job.status }}`. |
| 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. |
| 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) (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. |
| 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_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`. |
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)) {
return `<!${mention}> `;
} else if (mention !== '') {
return `<@${mention}> `;
return (
mention
.split(',')
.map(userId => `<@${userId}>`)
.join(' ') + ' '
);
}
return '';
}