From 50c674717b32c67e6aabe1151bb288dd6d4a1ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A1s=20Varga?= Date: Wed, 13 Oct 2021 13:27:19 -0400 Subject: [PATCH] feat: Allow empty SLACK_MSG_AUTHOR environment variable --- README.md | 2 +- main.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c98b467..ddf34ee 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Variable | Default | Purp ------------------|-------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------- 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_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. If set to an empty string, the message will not include the username. 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. diff --git a/main.sh b/main.sh index 0deb77b..e70c133 100644 --- a/main.sh +++ b/main.sh @@ -6,7 +6,7 @@ export SLACK_USERNAME=${SLACK_USERNAME:-"rtBot"} export CI_SCRIPT_OPTIONS="ci_script_options" export SLACK_TITLE=${SLACK_TITLE:-"Message"} export COMMIT_MESSAGE=$(cat "$GITHUB_EVENT_PATH" | jq -r '.commits[-1].message') -export GITHUB_ACTOR=${SLACK_MSG_AUTHOR:-"$GITHUB_ACTOR"} +export GITHUB_ACTOR=${SLACK_MSG_AUTHOR="$GITHUB_ACTOR"} hosts_file="$GITHUB_WORKSPACE/.github/hosts.yml"