{"id":15022188,"url":"https://github.com/rtcamp/action-slack-notify","last_synced_at":"2025-05-12T15:16:31.853Z","repository":{"id":37550249,"uuid":"173934970","full_name":"rtCamp/action-slack-notify","owner":"rtCamp","description":"GitHub Action for sending a notification to a Slack channel","archived":false,"fork":false,"pushed_at":"2025-04-21T06:13:36.000Z","size":212,"stargazers_count":1131,"open_issues_count":12,"forks_count":247,"subscribers_count":40,"default_branch":"master","last_synced_at":"2025-05-10T02:05:18.084Z","etag":null,"topics":["github-actions","hacktoberfest","research-development","slack"],"latest_commit_sha":null,"homepage":"https://github.com/rtCamp/github-actions-library","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rtCamp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-03-05T11:35:54.000Z","updated_at":"2025-05-09T13:17:38.000Z","dependencies_parsed_at":"2024-01-13T18:14:05.458Z","dependency_job_id":"9b1e7892-0619-4013-9e42-41ee1efb0b69","html_url":"https://github.com/rtCamp/action-slack-notify","commit_stats":{"total_commits":130,"total_committers":32,"mean_commits":4.0625,"dds":0.7153846153846154,"last_synced_commit":"c33737706dea87cd7784c687dadc9adf1be59990"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtCamp%2Faction-slack-notify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtCamp%2Faction-slack-notify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtCamp%2Faction-slack-notify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtCamp%2Faction-slack-notify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rtCamp","download_url":"https://codeload.github.com/rtCamp/action-slack-notify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253763964,"owners_count":21960484,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github-actions","hacktoberfest","research-development","slack"],"created_at":"2024-09-24T19:57:37.044Z","updated_at":"2025-05-12T15:16:31.648Z","avatar_url":"https://github.com/rtCamp.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"This action is a part of [GitHub Actions Library](https://github.com/rtCamp/github-actions-library/) created by [rtCamp](https://github.com/rtCamp/).\n\n# Slack Notify - GitHub Action\n[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)\n\n\nA [GitHub Action](https://github.com/features/actions) to send a message to a Slack channel.\n\n**Screenshot**\n\n\u003cimg width=\"485\" alt=\"action-slack-notify-rtcamp\" src=\"https://user-images.githubusercontent.com/4115/54996943-9d38c700-4ff0-11e9-9d35-7e2c16ef0d62.png\"\u003e\n\nThe `Site` and `SSH Host` details are only available if this action is run after [Deploy WordPress GitHub action](https://github.com/rtCamp/action-deploy-wordpress).\n\n## Usage\n\nYou can use this action after any other action. Here is an example setup of this action:\n\n1. Create a `.github/workflows/slack-notify.yml` file in your GitHub repo.\n2. Add the following code to the `slack-notify.yml` file.\n\n```yml\non: push\nname: Slack Notification Demo\njobs:\n  slackNotification:\n    name: Slack Notification\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v4\n    - name: Slack Notification\n      uses: rtCamp/action-slack-notify@v2\n      env:\n        SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}\n```\n\n3. Create `SLACK_WEBHOOK` secret using [GitHub Action's Secret](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets#creating-encrypted-secrets-for-a-repository). You can [generate a Slack incoming webhook token from here](https://slack.com/apps/A0F7XDUAZ-incoming-webhooks).\n\n\n## Environment Variables\n\nBy default, action is designed to run with minimal configuration but you can alter Slack notification using following environment variables:\n\n| Variable                 | Default                                               | Purpose                                                                                                                                                                                                                                                                                                                  |\n| ------------------------ | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| SLACK_CHANNEL            | Set during Slack webhook creation                     | Specify Slack channel in which message needs to be sent                                                                                                                                                                                                                                                                  |\n| SLACK_USERNAME           | `rtBot`                                               | Custom Slack Username sending the message. Does not need to be a \"real\" username.                                                                                                                                                                                                                                        |\n| 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 correct GitHub username.                                                                                                                                                                                       |\n| SLACK_ICON               | ![rtBot Avatar](https://github.com/rtBot.png?size=32) | User/Bot icon shown with Slack message. It uses the URL supplied to this env variable to display the icon in slack message.                                                                                                                                                                                              |\n| 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.                                                                                                              |\n| 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`.                                                                                 |\n| SLACK_LINK_NAMES         | -                                                     | If set to `true`, enable mention in Slack message.                                                                                                                                                                                                                                                                       |\n| SLACK_MESSAGE            | Generated from git commit message.                    | The main Slack message in attachment. It is advised not to override this.                                                                                                                                                                                                                                                |\n| SLACK_TITLE              | Message                                               | Title to use before main Slack message.                                                                                                                                                                                                                                                                                  |\n| SLACK_FOOTER             | Powered By rtCamp's GitHub Actions Library            | Slack message footer.                                                                                                                                                                                                                                                                                                    |\n| 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.)                                  |\n| 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](https://github.com/marketplace/actions/slack-markdown-converter)                             |\n| 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`)                                                                                    |\n| 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.                                                |\n| 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`.                                                                                                                                                                                     |\n| 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`.                                                                                                                                                                                     |\n| 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`.                                                                                                                                                                                   |\n| 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. |\n| 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.                                |\n| 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.                                                                                                                     |\n\n\nYou can see the action block with all variables as below:\n\n```yml\n    - name: Slack Notification\n      uses: rtCamp/action-slack-notify@v2\n      env:\n        SLACK_CHANNEL: general\n        SLACK_COLOR: ${{ job.status }} # or a specific color like 'good' or '#ff00ff'\n        SLACK_ICON: https://github.com/rtCamp.png?size=48\n        SLACK_MESSAGE: 'Post Content :rocket:'\n        SLACK_TITLE: Post Title\n        SLACK_USERNAME: rtCamp\n        SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}\n```\n\nBelow screenshot help you visualize message part controlled by different variables:\n\n\u003cimg width=\"600\" alt=\"Screenshot_2019-03-26_at_5_56_05_PM\" src=\"https://user-images.githubusercontent.com/4115/54997488-d1f94e00-4ff1-11e9-897f-a35ab90f525f.png\"\u003e\n\nThe `Site` and `SSH Host` details are only available if this action is run after [Deploy WordPress GitHub action](https://github.com/rtCamp/action-deploy-wordpress).\n\n## Hashicorp Vault (Optional) (Deprecated)\n\nThis GitHub action supports [Hashicorp Vault](https://www.vaultproject.io/).\n\nTo enable Hashicorp Vault support, please define following GitHub secrets:\n\nVariable      | Purpose                                                                       | Example Vaule\n--------------|-------------------------------------------------------------------------------|-------------\n`VAULT_ADDR`  | [Vault server address](https://www.vaultproject.io/docs/commands/#vault_addr) | `https://example.com:8200`\n`VAULT_TOKEN` | [Vault token](https://www.vaultproject.io/docs/concepts/tokens.html)          | `s.gIX5MKov9TUp7iiIqhrP1HgN`\n\nYou will need to change `secrets` line in `slack-notify.yml` file to look like below.\n\n```yml\non: push\nname: Slack Notification Demo\njobs:\n  slackNotification:\n    name: Slack Notification\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v4\n    - name: Slack Notification\n      uses: rtCamp/action-slack-notify@v2\n      env:\n        VAULT_ADDR: ${{ secrets.VAULT_ADDR }}\n        VAULT_TOKEN: ${{ secrets.VAULT_TOKEN }}\n```\n\nGitHub action uses `VAULT_TOKEN` to connect to `VAULT_ADDR` to retrieve slack webhook from Vault.\n\nIn the Vault, the Slack webhook should be setup as field `webhook` on path `secret/slack`.\n\n## Credits\nSource: [technosophos/slack-notify](https://github.com/technosophos/slack-notify)\n\n## License\n\n[MIT](LICENSE) © 2022 rtCamp\n\n## Does this interest you?\n\n\u003ca href=\"https://rtcamp.com/\"\u003e\u003cimg src=\"https://rtcamp.com/wp-content/uploads/sites/2/2019/04/github-banner@2x.png\" alt=\"Join us at rtCamp, we specialize in providing high performance enterprise WordPress solutions\"\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtcamp%2Faction-slack-notify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frtcamp%2Faction-slack-notify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtcamp%2Faction-slack-notify/lists"}