From 756c60e51967189c6e37166011927bbe219c0352 Mon Sep 17 00:00:00 2001 From: HsiangNianian Date: Fri, 16 Jan 2026 20:33:49 +0800 Subject: 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. --- .github/workflows/prek.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to '.github') 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]" -- cgit v1.2.3-70-g09d2 From 122beeee28a8e07caaa88634d3f09cfc53f55a61 Mon Sep 17 00:00:00 2001 From: HsiangNianian Date: Fri, 16 Jan 2026 20:35:50 +0800 Subject: chore: simplify GitHub Actions workflow by removing unnecessary auto-fix option Updated the GitHub Actions workflow to remove the 'all_files' option from the prek action, streamlining the process and ensuring that the action runs without additional parameters. This change enhances clarity and maintains the workflow's efficiency. --- .github/workflows/prek.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to '.github') diff --git a/.github/workflows/prek.yml b/.github/workflows/prek.yml index 4312e97..8e43763 100644 --- a/.github/workflows/prek.yml +++ b/.github/workflows/prek.yml @@ -35,12 +35,10 @@ jobs: librsvg2-dev \ pkg-config - - name: Run prek (auto-fix) + - name: Run prek id: prek uses: j178/prek-action@v1 continue-on-error: true - with: - all_files: true - name: Check for changes id: check_changes -- cgit v1.2.3-70-g09d2