From 3514646aa52f3dc00465729663d29007f68add88 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 21 Apr 2026 10:31:12 +0000 Subject: [PATCH] Skip commit and PR creation when formatting produces no changes Agent-Logs-Url: https://github.com/markgaze/automation/sessions/5478721d-278a-4ce7-bbbe-bdac36ef6037 Co-authored-by: markgaze <16718355+markgaze@users.noreply.github.com> --- format/action.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/format/action.yml b/format/action.yml index c261019..2f300b7 100644 --- a/format/action.yml +++ b/format/action.yml @@ -66,15 +66,25 @@ runs: run: pnpm run ${{ inputs.command }} shell: bash + - name: Check for changes + id: changes + run: | + if git diff --quiet; then + echo "detected=false" >> "$GITHUB_OUTPUT" + else + echo "detected=true" >> "$GITHUB_OUTPUT" + fi + shell: bash + - name: Commit changes - if: ${{ inputs.create-pr != 'true' }} + if: ${{ inputs.create-pr != 'true' && steps.changes.outputs.detected == 'true' }} uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 # v6 with: commit_message: ${{ inputs.commit-message }} branch: ${{ inputs.branch }} - name: Create Pull Request - if: ${{ inputs.create-pr == 'true' }} + if: ${{ inputs.create-pr == 'true' && steps.changes.outputs.detected == 'true' }} uses: peter-evans/create-pull-request@22a9089034f40e5a961c8808d113e2c98fb63676 # v7 env: CI: true