diff options
| author | 2026-01-16 20:33:49 +0800 | |
|---|---|---|
| committer | 2026-01-16 20:33:49 +0800 | |
| commit | 756c60e51967189c6e37166011927bbe219c0352 (patch) | |
| tree | 133374e971c735a9c3769bb2c74d1040e027065e /.github/workflows/prek.yml | |
| parent | 535f82514e38261688a15f1564638d6957129cc7 (diff) | |
| download | DropOut-756c60e51967189c6e37166011927bbe219c0352.tar.gz DropOut-756c60e51967189c6e37166011927bbe219c0352.zip | |
chore: enhance GitHub Actions workflow to check for changes before committing fixes
Updated the GitHub Actions workflow to include a step that checks for changes before committing auto-fixes. This ensures that commits are only made when there are actual changes, improving the efficiency of the workflow.
Diffstat (limited to '.github/workflows/prek.yml')
| -rw-r--r-- | .github/workflows/prek.yml | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/.github/workflows/prek.yml b/.github/workflows/prek.yml index b49447d..4312e97 100644 --- a/.github/workflows/prek.yml +++ b/.github/workflows/prek.yml @@ -42,8 +42,18 @@ jobs: with: all_files: true - - name: Commit fixes + - name: Check for changes + id: check_changes if: steps.prek.outcome == 'failure' + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "has_changes=true" >> $GITHUB_OUTPUT + else + echo "has_changes=false" >> $GITHUB_OUTPUT + fi + + - name: Commit fixes + if: steps.prek.outcome == 'failure' && steps.check_changes.outputs.has_changes == 'true' uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: "chore: apply prek auto-fixes [skip ci]" |