Skip to content

Commit

Permalink
fix: Add skip function
Browse files Browse the repository at this point in the history
  • Loading branch information
peaceiris committed Sep 23, 2019
1 parent 2cc02d4 commit f8dd9fa
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ function print_info() {
echo -e "\e[36mINFO: ${1}\e[m"
}

function skip() {
print_info "No changes detected, skipping deployment"
exit 0
}

# check values
if [ -n "${ACTIONS_DEPLOY_KEY}" ]; then

Expand Down Expand Up @@ -76,9 +81,7 @@ git add --all
print_info "Allowing empty commits: ${INPUT_EMPTYCOMMITS}"
COMMIT_MESSAGE="Automated deployment: $(date -u) ${GITHUB_SHA}"
if [[ ${INPUT_EMPTYCOMMITS} == "false" ]]; then
git commit -m "${COMMIT_MESSAGE}" || \
(print_info "No changes detected, skipping deployment" && \
exit 0)
git commit -m "${COMMIT_MESSAGE}" || skip
else
git commit --allow-empty -m "${COMMIT_MESSAGE}"
fi
Expand Down

0 comments on commit f8dd9fa

Please sign in to comment.