diff --git a/README.md b/README.md index cfab213..f8f2f8e 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ SLACK_MSG_AUTHOR | `$GITHUB_ACTOR` (The person who triggered action). | GitH 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. 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. +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. diff --git a/main.go b/main.go index 0f02b1a..77a62ad 100644 --- a/main.go +++ b/main.go @@ -23,6 +23,7 @@ const ( EnvSiteName = "SITE_NAME" EnvHostName = "HOST_NAME" EnvMinimal = "MSG_MINIMAL" + EnvSlackLinkNames = "SLACK_LINK_NAMES" ) type Webhook struct { @@ -31,6 +32,7 @@ type Webhook struct { IconURL string `json:"icon_url,omitempty"` IconEmoji string `json:"icon_emoji,omitempty"` Channel string `json:"channel,omitempty"` + LinkNames string `json:"link_names,omitempty"` UnfurlLinks bool `json:"unfurl_links"` Attachments []Attachment `json:"attachments,omitempty"` } @@ -195,6 +197,7 @@ func main() { IconURL: os.Getenv(EnvSlackIcon), IconEmoji: os.Getenv(EnvSlackIconEmoji), Channel: os.Getenv(EnvSlackChannel), + LinkNames: os.Getenv(EnvSlackLinkNames), Attachments: []Attachment{ { Fallback: envOr(EnvSlackMessage, "GITHUB_ACTION="+os.Getenv("GITHUB_ACTION")+" \n GITHUB_ACTOR="+os.Getenv("GITHUB_ACTOR")+" \n GITHUB_EVENT_NAME="+os.Getenv("GITHUB_EVENT_NAME")+" \n GITHUB_REF="+os.Getenv("GITHUB_REF")+" \n GITHUB_REPOSITORY="+os.Getenv("GITHUB_REPOSITORY")+" \n GITHUB_WORKFLOW="+os.Getenv("GITHUB_WORKFLOW")),