Code Monkey home page Code Monkey logo

action-slack-notify's Introduction

This action is a part of GitHub Actions Library created by rtCamp.

Slack Notify - GitHub Action

Project Status: Active – The project has reached a stable, usable state and is being actively developed.

A GitHub Action to send a message to a Slack channel.

Screenshot

action-slack-notify-rtcamp

The Site and SSH Host details are only available if this action is run after Deploy WordPress GitHub action.

Usage

You can use this action after any other action. Here is an example setup of this action:

  1. Create a .github/workflows/slack-notify.yml file in your GitHub repo.
  2. Add the following code to the slack-notify.yml file.
on: push
name: Slack Notification Demo
jobs:
  slackNotification:
    name: Slack Notification
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Slack Notification
      uses: rtCamp/action-slack-notify@v2
      env:
        SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
  1. Create SLACK_WEBHOOK secret using GitHub Action's Secret. You can generate a Slack incoming webhook token from here.

Environment Variables

By default, action is designed to run with minimal configuration but you can alter Slack notification using following environment variables:

Variable Default Purpose
SLACK_CHANNEL Set during Slack webhook creation Specify Slack channel in which message needs to be sent
SLACK_USERNAME rtBot Custom Slack Username sending the message. Does not need to be a "real" username.
SLACK_MSG_AUTHOR $GITHUB_ACTOR (The person who triggered action). GitHub username of the person who has triggered the action. In case you want to modify it, please specify corrent GitHub username.
SLACK_ICON rtBot Avatar User/Bot icon shown with Slack message. It uses the URL supplied to this env variable to display the icon in slack message.
SLACK_ICON_EMOJI - User/Bot icon shown with Slack message, in case you do not wish to add a URL for slack icon as above, you can set slack emoji in this env variable. Example value: :bell: or any other valid slack emoji.
SLACK_COLOR good (green) You can pass ${{ job.status }} for automatic coloring or an RGB value like #efefef which would change color on left side vertical line of Slack message. Other valid values for this field are: success, cancelled or failure.
SLACK_LINK_NAMES - If set to true, enable mention in Slack message.
SLACK_MESSAGE Generated from git commit message. The main Slack message in attachment. It is advised not to override this.
SLACK_TITLE Message Title to use before main Slack message.
SLACK_FOOTER Powered By rtCamp's GitHub Actions Library Slack message footer.
MSG_MINIMAL - If set to true, removes: Ref, Event, Actions URL and Commit from the message. You can optionally whitelist any of these 4 removed values by passing it comma separated to the variable instead of true. (ex: MSG_MINIMAL: event or MSG_MINIMAL: ref,actions url, etc.)
SLACKIFY_MARKDOWN - If set to true, it will convert markdown to slack format. (ex: *bold* to bold) Note: This only works for custom messages and not for the default message generated by the action. Credits: slackify-markdown-action
SLACK_THREAD_TS - If you want to send message in a thread, you can pass the timestamp of the parent message to this variable. You can get the timestamp of the parent message from the message URL in Slack. (ex: SLACK_THREAD_TS: 1586130833.000100)
SLACK_TOKEN - If you want to send message to a channel using a slack token. You will need to pass a channel in order to send messages using token, requiring a value for SLACK_CHANNEL. Note that in case both webhook url and token are provided, webhook url will be prioritized.
SLACK_MESSAGE_ON_SUCCESS - If set, will send the provided message instead of the default message when the passed status (through SLACK_COLOR) is success.
SLACK_MESSAGE_ON_FAILURE - If set, will send the provided message instead of the default message when the passed status (through SLACK_COLOR) is failure.
SLACK_MESSAGE_ON_CANCEL - If set, will send the provided message instead of the default message when the passed status (through SLACK_COLOR) is cancelled.
SLACK_CUSTOM_PAYLOAD - If you want to send a custom payload to slack, you can pass it as a string to this variable. This will override all other variables and send the custom payload to slack. Example: SLACK_CUSTOM_PAYLOAD: '{"text": "Hello, World!"}', Note: This payload should be in JSON format, and is not validated by the action.
SLACK_FILE_UPLOAD - If you want to upload a file to slack, you can pass the file path to this variable. Example: SLACK_FILE_UPLOAD: /path/to/file.txt. Note: This file should be present in the repository, or github workspace. Otherwise, should be accessable in the container the action is running in.
ENABLE_ESCAPES - If set to true, will enable backslash escape sequences such as \n, \t, etc. in the message. Note: This only works for custom messages and not for the default message generated by the action.

You can see the action block with all variables as below:

    - name: Slack Notification
      uses: rtCamp/action-slack-notify@v2
      env:
        SLACK_CHANNEL: general
        SLACK_COLOR: ${{ job.status }} # or a specific color like 'good' or '#ff00ff'
        SLACK_ICON: https://github.com/rtCamp.png?size=48
        SLACK_MESSAGE: 'Post Content :rocket:'
        SLACK_TITLE: Post Title
        SLACK_USERNAME: rtCamp
        SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

Below screenshot help you visualize message part controlled by different variables:

Screenshot_2019-03-26_at_5_56_05_PM

The Site and SSH Host details are only available if this action is run after Deploy WordPress GitHub action.

Hashicorp Vault (Optional) (Deprecated)

This GitHub action supports Hashicorp Vault.

To enable Hashicorp Vault support, please define following GitHub secrets:

Variable Purpose Example Vaule
VAULT_ADDR Vault server address https://example.com:8200
VAULT_TOKEN Vault token s.gIX5MKov9TUp7iiIqhrP1HgN

You will need to change secrets line in slack-notify.yml file to look like below.

on: push
name: Slack Notification Demo
jobs:
  slackNotification:
    name: Slack Notification
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Slack Notification
      uses: rtCamp/action-slack-notify@v2
      env:
        VAULT_ADDR: ${{ secrets.VAULT_ADDR }}
        VAULT_TOKEN: ${{ secrets.VAULT_TOKEN }}

GitHub action uses VAULT_TOKEN to connect to VAULT_ADDR to retrieve slack webhook from Vault.

In the Vault, the Slack webhook should be setup as field webhook on path secret/slack.

Credits

Source: technosophos/slack-notify

License

MIT © 2022 rtCamp

Does this interest you?

Join us at rtCamp, we specialize in providing high performance enterprise WordPress solutions

action-slack-notify's People

Contributors

0x2b3bfa0 avatar bogaertg avatar chenrui333 avatar devsibwarra avatar dhsathiya avatar hrithikdalal avatar kirtangajjar avatar l0rd-zer0 avatar lukasz-mitka avatar maitreyie-chavan avatar mbtamuli avatar mochetts avatar modalkonform avatar mrrobot47 avatar noamcohen97 avatar nuhkoca avatar ohbarye avatar paulsearcy avatar pradeep910 avatar rahul286 avatar topikito avatar vitorsavedra avatar yakkun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

action-slack-notify's Issues

Error sending message: Post "***": unsupported protocol scheme ""

version: rtcamp/action-slack-notify:v2.1.2
runs-on: ubuntu-latest
workflow triggered by workflow_dispatch (manually)

For some reason I get this kind of error:

Error sending message: Post "***": unsupported protocol scheme ""

I've defined step like this:

- name: Slack Notification
  uses: rtCamp/action-slack-notify@v2
  env:
    SLACK_CHANNEL: 'test'
    SLACK_MESSAGE: ':rocket:'
    SLACK_TITLE: 'test'
    SLACK_USERNAME: CI-bot
    SLACK_WEBHOOK: ${{ secrets.SLACK_BOT_TOKEN }}

secret and channel should be valid. Any idea what could be wrong?

Remove username and avatar when Github event is 'schedule'

Currently, when you set a workflow that runs automatically based on a schedule event, the username that appears in the notification is the one from the user that commited this change. This is undesirable and I would like to remove it.

Add Test Results as SLACK_MESSAGE

Hi,

is there any way to add a custom message on slack with the Tests Results executed on the job?

I saved the results on a JSON file and I can easily do a cat on the file to see the results in plain text, but I couldn't find a way to display this message as SLACK_MESSAGE.

Is there an easy way to do it? Thanks!

color is not set when using ${{job.status}}

Hi, when following the docs that say

You can pass ${{job.status}} for automatic coloring or an RGB value like #efefef which would change color on left side vertical line of Slack message.

No color is used.

We use

SLACK_COLOR: ${{ job.status }}
SLACK_MESSAGE: Workflow ${{ job.status }}

And see the message showing "Workflow success", so job.status is set to "success".

Add threading support

I would like to propose to add threading support. In our workflow we create a Slack message and later on we would like to add more replies to it.

In order to do this action needs support ts input and output variables as described here: https://api.slack.com/messaging/sending#threading

I'm not too much familiar with Go, but I can provide a PR if you are ok with this change and can give some guidance on how I could implement this.

No support for windows-latest

Hi,

Until the action is not supported on windows-latest, it should be written in the documentation that it runs only on ubuntu.

Thanks

Invalid Action URL

I recently started noticing that the Action URL generated is pointing to a dead link. Looking at the source code it seems to use the GITHUB_SHA env variable to dynamically generate the link. However, this SHA seems to be incorrect. If I update the link in my browser to use the commit sha of the head of my branch the link correctly works again. For example in a Github Action this is ${{ github.event.pull_request.head.sha }}. This may not be a issue exactly with this tool but perhaps it would be beneficial to add a override env variable to allow passing in this sha. I've tried doing this already but it doesn't seem like I can override GITHUB_SHA as is.

Passing secrets in YAML format?

I'm using a .yml workflow file, and trying to use this action. I am having trouble understanding how to pass the slack webhook url in YAML format, since it seems to be passed in separately from the env variables?

Request to make actionUri configurable

Hi,

I wanted to know if its possible to make the actionUri configurable or atleast point to the commit instead of its checks?
Maybe creating an env variable to append the /checks onto the action URI

Kind regards,
Rajiv

MSG_MINIMAL not working

I have set MSG_MINIMAL: true but I still have

Ref
Event
Actions URL

I also tried MSG_MINIMAL: "true" but result is same

can you help me

Is there an option to disable the default icon?

First, thank you for making this action available to us all 💐

Slack enables setting an icon for the incoming message on the webhook con figuration and I want to use the icon I set there, instead of the action's default. Is there an option for that?

Add GITHUB_URL

Many companies are using github enterprices, so github.com url won't work for them

How to change SLACK_COLOR on success, cancelled, or failure?

Sorry for such a basic question, but any help would be appreciated. I'm trying to make the slack notification change colors depending on the Github Action's success, cancellation, or failure.

The following seems to work for me:

    - name: Slack Notification - Success
      if: success()
      uses: rtCamp/[email protected]
      env:
        SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

    - name: Slack Notification - Failure
      if: cancelled() || failure()
      uses: rtCamp/[email protected]
      env:
        SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
        SLACK_COLOR: 'danger'

But is there a more efficient way to write this? Seems like a lot of code just to change color. I'm not seeing a way to use if conditionals to change env values...otherwise I would set SLACK_COLOR to good or danger if success/cancel/failure.

Unable to find image 'ghcr.io/rtcamp/action-slack-notify:v2.1.3' locally

Our builds are failing with the following error:

Run rtCamp/action-slack-notify@v2
/usr/bin/docker run --name ghcriortcampactionslacknotifyv213_709c93 --label 5588e4 --workdir /github/workspace --rm -e NODE_AUTH_TOKEN -e SLACK_WEBHOOK -e SLACK_USERNAME -e SLACK_ICON_EMOJI -e MSG_MINIMAL -e SLACK_MESSAGE -e SLACK_COLOR -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/grill/grill":"/github/workspace" ghcr.io/rtcamp/action-slack-notify:v2.1.3
Unable to find image 'ghcr.io/rtcamp/action-slack-notify:v2.1.3' locally
v2.1.3: Pulling from rtcamp/action-slack-notify
c9b1b535fdd9: Pulling fs layer
f597b81b5d49: Pulling fs layer
5315175e77ba: Pulling fs layer
180cd15dbe12: Pulling fs layer
f47731e8b606: Pulling fs layer
35c5edac0302: Pulling fs layer
25c20a50cc35: Pulling fs layer
180cd15dbe12: Waiting
f47731e8b606: Waiting
35c5edac0302: Waiting
25c20a50cc35: Waiting
docker: error pulling image configuration: denied: unauthenticated: User cannot be authenticated with the token provided

Looks like someone made the image private.

Unable to get running with basic config

Used the example from documentation:

on: push
name: Slack Notification Demo
jobs:
slackNotification:
name: Slack Notification
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Slack Notification
uses: rtCamp/[email protected]
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

Configured a secret: SLACK_WEBHOOK on
https://github.com/organizations/myproject/settings/secrets

Getting error:
[ERROR] Secret SLACK_WEBHOOK is missing. Please add it to this action for proper execution.

Not sure what I am missing.

(also your documentation has a broken link for github documentation for setting secrets)

Update on pull request

Hi, would it be possible for this to update the message field when the event is on pull_request? Currently it comes back as null.

It would be also helpful if it came back with success or not if the current job was succesful etc

Thank you

Not pulling secrets

I have the SLACK_WEBHOOK var configured in Secrets. I am trying to use this

        env:
          SLACK_MESSAGE: 'Post Content: Testing slackNotifications from github-actions.'
          SLACK_CHANNEL: '#test'
          SLACK_USERNAME: github-actions-test
          SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

If I have the webhook url hard-coded it works fine, if i try to pull it from secrets, it throws this error. Any thoughts why?

Secret SLACK_WEBHOOK is missing. Please add it to this action for proper execution.

Does not work on ARM self hosted runners.

Run rtCamp/action-slack-notify@v2
  env:
    IMAGE_REPO: ***/***
    IMAGE_TAG: sha-c8a3b726c80f7a55cd22e5d4f4bf578dec90acf5
    SLACK_COLOR: success
    SLACK_WEBHOOK: ***
/usr/bin/docker run --name ghcriortcampactionslacknotifyv213_d2b458 --label c3f261 --workdir /github/workspace --rm -e IMAGE_REPO -e IMAGE_TAG -e SLACK_COLOR -e SLACK_WEBHOOK -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/ubuntu/stacks/system/github-actions-work/4dbfa5e3e9149/_temp/_github_home":"/github/home" -v "/home/ubuntu/stacks/system/github-actions-work/4dbfa5e3e9149/_temp/_github_workflow":"/github/workflow" -v "/home/ubuntu/stacks/system/github-actions-work/4dbfa5e3e9149/_temp/_runner_file_commands":"/github/file_commands" -v "/home/ubuntu/stacks/system/github-actions-work/4dbfa5e3e9149/***/***":"/github/workspace" ghcr.io/rtcamp/action-slack-notify:v2.1.3
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
standard_init_linux.go:219: exec user process caused: exec format error

about line break and hyper link

First of all, thank you so much for your plugin.
It's really good :)

By the way, I want some requests. It might be silly requests.

  1. line break with message or title
    I tried with below. But I can not insert line break.
  • Hello\nWorld => Hello\nWorld
  • Hello\nWorld => Hello\nWorld
  • Hello%0AWorld => Hello%0AWorld
  1. make Action URL link short like below
    I think if you make a hyperlink, it will look more readable

스크린샷 2020-11-25 오후 6 48 27

Can I use env var in SLACK_TITLE?

      - uses: actions/checkout@v2
      - name: Send Slack Notification
        uses: rtCamp/[email protected]
        env:
          SLACK_WEBHOOK: 'https://xxxx'
          SLACK_TITLE: ':rocket:【Android】App Tester:rocket:\nバージョン: v${VERSION}(${BUILD_NUMBER})\nリリースノート:\n${RELEASE_NOTE}'

Request for support to add attachment env var

Hi, it would be awesome if we could add an attachment env var to support adding a file such as html report.

i've tried using some of the other github actions that have this but they don't seem to work and i've had best success with this one.

did you consider adding support for markdown

At the moment, to get a beautiful markdown in slack, I need to convert input first with this action https://github.com/LoveToKnow/slackify-markdown-action. My input message looks like [${{github.event.issue.title}}](${{github.event.issue.html_url}}) \n ${{github.event.issue.body}} so I really cannot manually make it "slack" compatible as I do not have control over issue body.

but it looks like it is a simple as adding https://github.com/jsarafajr/slackify-markdown and enabling someone to specify if they want to slackify markdown in message or not.

Drop default values of SLACK_ICON & SLACK_USERNAME

Currently the plugin sets default values for these:

export SLACK_ICON=${SLACK_ICON:-"https://avatars0.githubusercontent.com/u/43742164"}
export SLACK_USERNAME=${SLACK_USERNAME:-"rtBot"}

IMHO it would be better to leave them empty, in which case Slack would use the values defined in the webhook itself:
image

Icon Emoji not working

No matter what syntax I chose, the Icon Emoji is never being shown. I tried house, :house: and ':house:' without success. Any idea for the reason? Did Slack change anything on their side?

    - name: Slack Notification
      uses: rtCamp/[email protected]
      env:
        SLACK_CHANNEL: teg-baugebiets-map
        SLACK_ICON_EMOJI: ':house:'
        SLACK_MESSAGE: 'New version: https://blabla/index.html'
        SLACK_TITLE: 'Hausbau'
        SLACK_USERNAME: The Architect
        SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

Building every time

Is there a way not to build every time? it's consuming 1 minute for every action I run. This has impact in my billing as I run a lot of actions per month

Docker hub toomanyrequest error

Seeing this error when using this action on a self-hosted runner (uses: rtCamp/[email protected])

Pull down action image 'rtcamp/action-slack-notify:v2.0.2'
  /usr/bin/docker pull rtcamp/action-slack-notify:v2.0.2
  Error response from daemon: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit
  Warning: Docker pull failed with exit code 1, back off 5.965 seconds before retry.
  /usr/bin/docker pull rtcamp/action-slack-notify:v2.0.2
  Error response from daemon: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit
  Warning: Docker pull failed with exit code 1, back off 8.716 seconds before retry.
  /usr/bin/docker pull rtcamp/action-slack-notify:v2.0.2
  Error response from daemon: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit

Is there a different public repository that can be used?

Feature request - customize github actor

Right now the actor is always who triggered the action, but it would be nice if this could be customized (i.e. manually pick the PR author even if it is triggered from someone else merging it, etc). Related - an option to hide this if it's not relevant

New release?

Thanks for the great job on this action. I was checking the releases on this repo and I saw that the last one was make almost a year ago, any plans to create a new one to have the latest changes included?

SLACK_MESSAGE is null when Trigger is On - Release Type [Published]

I'm attempting to notify our dev group when a release is made to also include the release notes. I have the trigger tied to the release and the release notes generate for the linked tag. However the release notes do not show in the SLACK_MESSAGE. Is there a specific way this needs to be configured that you could provide me an example of?

workflow.yml:

name: Release Notification
on:
  release:
    types: [published]
jobs:
  slackNotification:
    name: Release Notification
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Release Notification
      uses: rtCamp/action-slack-notify@v2
      env:
        SLACK_USERNAME: Release Notification
        SLACK_WEBHOOK: ${{ secrets.SLACK_RELEASE_URL }}

Github Release Notes:
image

Slack Notification:
image

Env variable for icon_emoji

Currently the package only supports using an icon with a URL, but it would be nice to be able to use built in Slack Emoji's using the icon_emoji property as an alternative.

Does this action impact subsequent success() or failure() or overall job status?

I'd like to use this action to notify Slack if one of my steps fails, like so:

    - name: Slack Notify dotnet-build Failure
      if: failure()
      uses: rtCamp/[email protected]
      env: 
        SLACK_TITLE: ":rotating_light: dotnet-build Failure"
        SLACK_MESSAGE: "My failure message..."

This would be the last step in one of my jobs, and I have another job that relies on this first job with needs. What I'm wondering is if failure() is true, and this action to notify Slack runs and succeeds, is the exit code for this job considered a success (due to the Slack notification), or a failure (due to the step that failed prior to the Slack notification)?

Env variables in slack message

I'm having trouble getting env variables into the slack message like so:

SLACK_MESSAGE: "Staging deployment complete: $GITHUB_SHA ${GITHUB_SHA}"

None of these seem to work. Am I doing something wrong?

mentioning someone? (feature request)

Would it be overly complex to add the option to mention someone? sadly bots don't trigger notifications for keywords so the only option would be to manually notify users --- even using the member id would be super helpful.

Collapsing Actions URL to a link

UX improvement request: to decrease the verbosity of the message it would be great to have an option to send "Actions URL" a "link" vs the full blown URL text, with an ability to customize the link's text.

So, something like this:

image

Overwriting SLACK_MESSAGE

I know the docs advise against doing this, but is there a way to do this at the moment with anything other than a plain text string? I would like to add a URL or interpolate another value such as an environment variable in this field if possible. In the case of passing a URL currently to SLACK_MESSAGE, the value output in slack is null.

Example:
SLACK_MESSAGE: 'this is a test'
Output on Slack: 'this is a test'

SLACK_MESSAGE: 'https://someurl.com'
Output on Slack: null

Thanks!

Avoid building the action container in every job

First of all: Thank you for the good work here. Good job. 👍

I'm quite new to Github Actions and would like to ask if there is any way to avoid that in every single job (we use it to send a Slack notification in the case of a faillure) the container for this Action here gets built again?

Thank you in advance.

Unable to send notification in macOS

I am trying to send Slack notification when the job is running using macos-latest.
Error received is:

##[error]Container action is only supported on Linux

I am aware that Dockerfile is using alpine distribution. Is there a way we can achieve the same for macos?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.