Skip to content

Commit

Permalink
Read hosts.yml only if present
Browse files Browse the repository at this point in the history
Signed-off-by: Riddhesh Sanghvi <[email protected]>
  • Loading branch information
mrrobot47 committed Jan 17, 2020
1 parent 29a7871 commit 6a14db3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ export COMMIT_MESSAGE=$(cat "/github/workflow/event.json" | jq .commits | jq '.[
hosts_file="$GITHUB_WORKSPACE/.github/hosts.yml"

if [[ -z "$SLACK_CHANNEL" ]]; then
user_slack_channel=$(cat "$hosts_file" | shyaml get-value "$CI_SCRIPT_OPTIONS.slack-channel" | tr '[:upper:]' '[:lower:]')
if [[ -f "$hosts_file" ]]; then
user_slack_channel=$(cat "$hosts_file" | shyaml get-value "$CI_SCRIPT_OPTIONS.slack-channel" | tr '[:upper:]' '[:lower:]')
fi
fi

if [[ -n "$user_slack_channel" ]]; then
Expand Down

0 comments on commit 6a14db3

Please sign in to comment.