From 6a14db308cb6898d5438103ad5a0d923f00727c9 Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Fri, 17 Jan 2020 10:55:53 +0530 Subject: [PATCH] Read hosts.yml only if present Signed-off-by: Riddhesh Sanghvi --- main.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.sh b/main.sh index dc65597..27cf17a 100644 --- a/main.sh +++ b/main.sh @@ -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