diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2ddac76..8acbd12 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,8 +29,4 @@ jobs: - name: Update database run: | cd recurring-execution-with-actions - git config user.email "action@github.com" - git config user.name "GitHub Action" - git add isahn_history.json - git commit -m 'Update history' - git push -f origin master + ./updateDB.sh diff --git a/recurring-execution-with-actions/updateDB.sh b/recurring-execution-with-actions/updateDB.sh new file mode 100755 index 0000000..7efbb39 --- /dev/null +++ b/recurring-execution-with-actions/updateDB.sh @@ -0,0 +1,17 @@ +#!/bin/bash +cd recurring-execution-with-actions +git add isahn_history.json +set +e # Grep succeeds with nonzero exit codes to show results. +git status | grep modified +if [ $? -eq 0 ] +then + set -e + git config user.email "action@github.com" + git config user.name "GitHub Action" + git commit -am "updated on - $(date)" + git push origin master +else + set -e + echo "No changes since last run" +fi +