slack-github-action
slack-github-action copied to clipboard
Support multiple channel IDs
Description
The channel-id
input supports a single channel ID. Can this be updated to support multiple comma-separated channel ID's?
What type of issue is this? (place an x
in one of the [ ]
)
- [ ] bug
- [x] enhancement (feature request)
- [ ] question
- [ ] documentation related
- [ ] example code related
- [ ] testing related
- [ ] discussion
Requirements (place an x
in each of the [ ]
)
- [x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
- [x] I've read and agree to the Code of Conduct.
- [x] I've searched for any related issues and avoided creating a duplicate issue.
Hi @glenthomas thanks for writing in!
Supporting an array type for the channel-id property seems like a reasonable feature, I went ahead and labeled the issue as an enhancement.
In the mean time I believe using something like multiple steps in a job could be a valid work around for the issue
on: [push]
jobs:
new_push_job:
runs-on: ubuntu-latest
name: Post to slack channels
steps:
- name: Publish to slack channel A via bot token
id: slack
uses: slackapi/[email protected]
with:
channel-id: 'CHANNEL_ID_A'
slack-message: 'posting from a github action to channel A!'
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
- name: Publish to slack channel B via bot token
id: slack
uses: slackapi/[email protected]
with:
channel-id: 'CHANNEL_ID_B'
slack-message: 'posting from a github action to channel B!'
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
FYI this has been released in v1.22. Big ups to @treemmett for implementing, adding tests and updating the docs ❤️ .
Thanks! What about message updates. How does it work in this case? I tried passing multiple channels and then updating the messages with the same returned ts
. It only updates the message in one of the channels and returns this error: Error: An API error occurred: message_not_found
.