Skip to content

Commit 81279d7

Browse files
authored
🎨 check if there are changes to commit (#49)
1 parent 6f12e20 commit 81279d7

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

action.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,15 @@ runs:
148148
run: |
149149
commit_changes () {
150150
if [[ ${{ steps.preparation.outputs.push }} == "true" ]]; then
151-
git add . && git commit -m "Release ${{ inputs.docker-registry }}/${{ inputs.docker-image }}:${{ steps.preparation.outputs.tag }}"
151+
git add .
152+
153+
# commit with no errors if there are no changes
154+
if git diff-index --quiet HEAD; then
155+
echo "There were no changes..."
156+
return
157+
fi
158+
159+
git commit -m "Release ${{ inputs.docker-registry }}/${{ inputs.docker-image }}:${{ steps.preparation.outputs.tag }}"
152160
# In case there was another push in the meantime, we pull it again
153161
git pull --rebase https://${{ inputs.gitops-user }}:${{ inputs.gitops-token }}@github.com/${{ inputs.gitops-organization }}/${{ inputs.gitops-repository }}.git
154162
git push https://${{ inputs.gitops-user }}:${{ inputs.gitops-token }}@github.com/${{ inputs.gitops-organization }}/${{ inputs.gitops-repository }}.git

0 commit comments

Comments
 (0)