From f0f0c60799fcdfa4babc849939b2190b327287d1 Mon Sep 17 00:00:00 2001 From: Andrius Kairiukstis Date: Mon, 16 May 2022 18:00:09 +0200 Subject: [PATCH] fetch-asterisk-releases - skip git operations if there is no updates --- .github/workflows/fetch-asterisk-releases.yml | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/fetch-asterisk-releases.yml b/.github/workflows/fetch-asterisk-releases.yml index 211d987..3a89060 100644 --- a/.github/workflows/fetch-asterisk-releases.yml +++ b/.github/workflows/fetch-asterisk-releases.yml @@ -32,7 +32,7 @@ jobs: - name: Fetch asterisk releases shell: bash run: | - set -ueox pipefail + set -ueo pipefail URLS=( \ http://downloads.asterisk.org/pub/telephony/asterisk/releases/ \ @@ -80,16 +80,20 @@ jobs: - name: Commit and push updates shell: bash run: | - set -ueox pipefail + set -ueo pipefail - git config user.email "github-actions@users.noreply.github.com" - git config user.name "github-actions[bot]" + if [ "$(git status -s)" == "" ]; then + git config user.email "github-actions@users.noreply.github.com" + git config user.name "github-actions[bot]" - git add ./asterisk-releases.txt - git add ./asterisk-certified-releases.txt - git commit \ - --all \ - --allow-empty \ - --message "[$(date '+%Y-%m-%d %H:%M')] automatic update of asterisk release lists" + git add ./asterisk-releases.txt + git add ./asterisk-certified-releases.txt + git commit \ + --all \ + --allow-empty \ + --message "[$(date '+%Y-%m-%d %H:%M')] automatic update of asterisk release lists" - git push + git push + else + echo "Nothing to push, no updates" + fi