archive / github-actions-slack Goto Github PK
View Code? Open in Web Editor NEWGithub Action for sending message (and reactions/threads/update/blocks) to Slack - With support for Slack's optional arguments
License: MIT License
Github Action for sending message (and reactions/threads/update/blocks) to Slack - With support for Slack's optional arguments
License: MIT License
Currently, I can see Error: {}
in the output which is not very useful. Maybe you can add more information when the error occurs.
In my case, I'm trying to replay in the thread and I guess the message format is wrong (I guess)
https://api.slack.com/events/message/reply_broadcast
The
reply_broadcast
message subtype is no longer served. It has been replaced withthread_broadcast
.
Hello, thanks for the work done.
Do you plan to support node 20 ?
Can we attach files?
We are running some automated tests. I'd really like it if I could attach failed testing results as a .txt file to a Slack message, to alert the developer.
This is a little easier than having them dig through GitHub log files.
Is there any way to do this? I didn't see it listed in the features, so this could be a useful add.
I may have a work around with my product to just use Sendmail, but slack is really our preferred communication channel!
== John ==
The README suggests using slack-blocks
, but the correct input would be slack-optional-blocks
.
@chiedo keen on getting a backward compatible version out in this repo?
Hello
Thanks for this action, very nice. One thing I'm wondering is whether it would be possible to add support for including optional params on message update. I'm thinking of appending block sections as new details become available during a build.
Also, would it be possible to include an example showing the use of attachments/blocks? I managed it but found it a bit tricky, and it wasn't 100% clear on what other params were mandatory - I had to go to the code for that. Also, I believe it's possible to send just a block section, so maybe don't make the text field mandatory?
Thanks again.
Action is producing warning below:
Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files.
For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
It looks like it is impossible to use text with new lines \n
when using update-message
uses: archive/github-actions-slack@master
if: failure()
with:
slack-function: update-message
slack-bot-user-oauth-access-token: ${{ secrets.SLACK_BOT_TOKEN }}
slack-channel: ${{ fromJson(steps.send-message.outputs.slack-result).response.channel }}
slack-update-message-text: ${{ steps.messages.outputs.failed }}
slack-update-message-ts: ${{ fromJson(steps.send-message.outputs.slack-result).response.message.ts }}
slack-optional-unfurl_media: false
slack-optional-unfurl_links: false
In my case in ${{ steps.messages.outputs.failed }}
I have complex message with new lines and emojis. Original text will edited but text will be in one line
Build: Android 1.5.5.0 (1567) \n failed
When passing slack example from the documentation
This is a line of text.\nAnd this is another one.
Should appear on slack like:
This is a line of text.
And this is another one.
But instead it shows
This is a line of text.\nAnd this is another one.
This is likely because you're escaping the escape character, in the payload...
{"channel":"some-channel","text":"This is a line of text.\\nAnd this is another one."}
Hi, thanks for this Action. It seems that around May 2020, GitHub added validation resulting in warnings like this:
##[warning]Unexpected input(s) 'slack-optional-icon_emoji', valid inputs are ['slack-bot-user-oauth-access-token', 'slack-channel', 'slack-text', 'slack-optional-x']
The icon_emoji
input also isn't passed in as an INPUT_...
environment variable. So this mechanism will, unfortunately, need to be rethought.
Discussion/similar issue in another Action: cypress-io/github-action#141
I was thinking that since lack-optional-thread_ts
is already supported, it would be neat if (like with voxmedia/github-action-slack-notify-build
) it was possible to update an existing message with new content. Mostly to change status during deployment from initial started
to failure
or success
. Would that be difficult to implement?
Currently, the multi-channel works only for send-message. We have a use case to update the same message on multiple channels. Can we add this feature?
The sample action files that use the Slack's Block Kit uses the slack-blocks
parameter instead of slack-optional-blocks
in .github/workflows/12-slack-message-blocks-update.yml
and .github/workflows/11-slack-message-blocks.yml
.
I'm trying to use this action but I keep getting an error
Run archive/[email protected]
with:
slack-bot-user-oauth-access-token: ***
slack-channel: software-website
slack-text: just work
slack-optional-icon_emoji: :rocket:
DEBUG: Payload {"channel":"software-website","text":"just work","icon_emoji":":rocket:"}
Error: ["\"Error! {\\\"statusCode\\\":200,\\\"result\\\":\\\"{\\\\\\\"ok\\\\\\\":false,\\\\\\\"error\\\\\\\":\\\\\\\"not_in_channel\\\\\\\"}\\\"}\""]
It doesn't make any sense because I have the app installed to my workspace and the bot seems to be in the channel:
I tried both channel IDs and names. This shit just doesn't work lol.
Hi, great library!
We use this to send a message like
๐ Deploying to production
Just before a deployment kicks off.
Since the slack-result
output contains channel
and timestamp
fields, it'd be very useful to be able to add a โ๏ธ emoji to the same message after the deployment is complete (or โ if it failed). I was imagining something like this, with a new method
input corresponding to https://api.slack.com/methods/chat.postMessage
, https://api.slack.com/methods/reactions.add
etc.:
- id: notify
uses: archive/[email protected]
with:
method: chat.postMessage # this would be the default method for backwards compatibility
slack-bot-user-oauth-access-token: ${{ secrets.SLACK_BOT_USER_OAUTH_ACCESS_TOKEN }}
slack-channel: deployments
slack-text: ':rocket: Deploying to production'
- run: ./deploy.sh
- uses: archive/[email protected]
with:
method: reactions.add
slack-bot-user-oauth-access-token: ${{ secrets.SLACK_BOT_USER_OAUTH_ACCESS_TOKEN }}
slack-channel: ${{ steps.notify.outputs.slack-result.channel }}
timestamp: ${{ steps.notify.outputs.slack-result.ts }}
name: white_check_mark
Hello!
Thanks for the great action @archive!
With regards to:
https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/
It would be great to get this action updated to reduce deprecation warnings ๐
Not urgent otherwise as NodeJS12 isn't going anywhere soon.
Happy to raise a PR, but maybe easiest for someone with push access to bump the version and check everything looks OK!
github-actions-slack/action.yml
Line 75 in deecc2e
Cheers!
Tried this workflow and the message I get in slack is not showing and emoji. Not sure why but I tried a non custom one. I would ultimately like to send a custom one.
This is the message I received but no icon. In the input you can see the fire icon is shown and so its enabled but through this action icon_emoji does not work.
name: Manual Test of Slack Messaging
on:
workflow_dispatch:
jobs:
slack-notifications:
runs-on: ubuntu-20.04
name: Sends a message to Slack when a push, a pull request or an issue is made
steps:
- name: Send message to Slack API
uses: archive/[email protected]
id: notify
with:
slack-bot-user-oauth-access-token: ${{ secrets.SLACK_BOT_TOKEN }}
slack-channel: *********
slack-text: Hello! Event "${{ github.event_name }}" in "${{ github.repository }}"
slack-optional-icon_emoji: ":fire:"
- name: Result from "Send Message"
run: echo "The result was ${{ steps.notify.outputs.slack-result }}"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.