From f50bc7c8480a695b74fad35694a0020836a897b2 Mon Sep 17 00:00:00 2001 From: Andros Fenollosa Date: Sun, 18 Apr 2021 21:34:23 +0200 Subject: [PATCH] Update updateDB --- .github/workflows/main.yml | 6 +----- recurring-execution-with-actions/updateDB.sh | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) create mode 100755 recurring-execution-with-actions/updateDB.sh 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 +