Skip to content

Commit b7f908e

Browse files
authored
Merge pull request #66 from fabianegli/patch-1
Allow Action to succeed even if no changes were made
2 parents ec454b7 + 30ee957 commit b7f908e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

.github/workflows/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ jobs:
3232
echo "... done."
3333
git --no-pager diff
3434
git add -A
35+
if [ -z "$(git diff --staged)" ]; then
36+
# To have the action run successfully, if no changes are staged, we
37+
# manually skip the later commits because they fail with exit code 1
38+
# and this would then display as a failure for the Action.
39+
echo "No staged changes to commit. Skipping commit and push."
40+
exit 0
41+
fi
3542
if [ -n "${{ inputs.message }}" ]; then
3643
git commit -m "${{ inputs.message }}"
3744
else

0 commit comments

Comments
 (0)