Giter VIP home page Giter VIP logo

action-slack-notify's People

Contributors

0x2b3bfa0 avatar anagyzambo-kx avatar bogaertg avatar chenrui333 avatar dependabot[bot] 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  avatar

action-slack-notify's Issues

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)?

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.

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

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

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

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?

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.

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

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

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!

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?

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.

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?

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?

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

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.

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

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?

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)

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.

Add GITHUB_URL

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

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 }}

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?

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.

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?

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

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

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

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!

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".

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.

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}'

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.

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.

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.

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.

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.