@@ -47,6 +47,10 @@ inputs:
4747 description : >
4848 The email address of the user to ascribe the commit to.
4949 default : no-reply@github.com
50+ exclude :
51+ description : >
52+ A pattern to describe what files to omit from the committed.
53+ default : " "
5054outputs :
5155 branch :
5256 description : >
@@ -55,7 +59,7 @@ outputs:
5559 changed :
5660 description : >
5761 Whether there were any changes committed.
58- value : ${{ steps.detect .outputs.changed }}
62+ value : ${{ steps.push .outputs.work == 1 }}
5963runs :
6064 using : composite
6165 steps :
@@ -92,14 +96,25 @@ runs:
9296 USER_EMAIL : ${{ inputs.commit-user-email }}
9397 - name : push changes
9498 if : steps.detect.outputs.changed == 1
99+ id : push
95100 working-directory : ${{ inputs.working-directory }}
96101 run : |
97102 git checkout -b "$NEW_BRANCH"
98- git add -A
99- git commit -a -m "$MESSAGE"
100- git push origin "$NEW_BRANCH"
103+ if [ -z "$EXCLUDE" ]; then
104+ git add -A
105+ else
106+ git add --all -- "${EXCLUDE/#/:!}"
107+ fi
108+ if git diff --cached --exit-code >/dev/null; then
109+ echo "work=0" >> $GITHUB_OUTPUT
110+ else
111+ git commit -a -m "$MESSAGE"
112+ git push origin "$NEW_BRANCH"
113+ echo "work=1" >> $GITHUB_OUTPUT
114+ fi
101115 shell : bash
102116 env :
103117 GH_TOKEN : ${{ inputs.token }}
104118 NEW_BRANCH : ${{ steps.name.outputs.branch }}
105119 MESSAGE : ${{ inputs.commit-message }}
120+ EXCLUDE : ${{ inputs.exclude }}
0 commit comments