Skip to content

Commit

Permalink
Exit early if no changes (#60)
Browse files Browse the repository at this point in the history
Co-authored-by: Spenser Black <spenserblack01@gmail.com>
  • Loading branch information
jcbhmr and spenserblack authored Apr 17, 2023
1 parent 416ff7f commit 61322d1
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,21 @@ git remote add origin "https://$INPUT_TOKEN@$INPUT_REPOSITORY.wiki.git"
git fetch origin
git reset origin/master

# https://stackoverflow.com/a/2659808
if git diff-index --quiet HEAD --; then
echo 'No changes! Will not commit or push.'
rm -rf .git
exit 0
fi

git add --all
git commit -m "$INPUT_COMMIT_MESSAGE"

if [[ $INPUT_DRY_RUN == true ]]; then
git remote show origin
git show
git remote show origin
git show
else
git push -u origin master
git push -u origin master
fi

rm -rf ./.git

0 comments on commit 61322d1

Please sign in to comment.