Skip to content

Commit 5104f18

Browse files
authored
Merge pull request #7 from packagist/skip-branch-push-if-commit-is-empty
Don't push branch if there are no changes
2 parents 48098d0 + 677c286 commit 5104f18

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

action.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,13 @@ runs:
6767

6868
- name: Store number of changed files
6969
id: number_of_changed_files
70-
run: echo "COUNT=$(git --no-pager diff --name-only HEAD~ | wc -l | tr -d ' ')" >> $GITHUB_OUTPUT
70+
run: echo "COUNT=$(git --no-pager diff --name-only $GITHUB_SHA | wc -l | tr -d ' ')" >> $GITHUB_OUTPUT
7171
shell: bash
7272

7373
- name: Push branch
7474
run: git push origin $BRANCH --force
7575
shell: bash
76+
if: ${{ steps.number_of_changed_files.outputs.COUNT != 0 }}
7677
env:
7778
BRANCH: ${{ github.event.client_payload.branch }}
7879

0 commit comments

Comments
 (0)