From 1c008a1742bb12a974ec52c073b1e9b96fab2644 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Fri, 24 Jan 2025 14:09:09 +0100 Subject: [PATCH] diff check --- .github/workflows/auto-update-app-headers.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/auto-update-app-headers.yml b/.github/workflows/auto-update-app-headers.yml index f1303ebd..3d01ec45 100644 --- a/.github/workflows/auto-update-app-headers.yml +++ b/.github/workflows/auto-update-app-headers.yml @@ -39,11 +39,17 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Step 5: Check for changes + # Step 5: Check if there are any changes - name: Check if there are any changes id: verify-diff run: | - git diff --quiet . || echo "changed=true" >> $GITHUB_OUTPUT + if git diff --quiet; then + echo "No changes detected." + echo "changed=false" >> $GITHUB_OUTPUT + else + echo "Changes detected." + echo "changed=true" >> $GITHUB_OUTPUT + fi # Step 6: Commit changes (if any) and create a PR - name: Commit and create PR if changes exist @@ -51,8 +57,9 @@ jobs: run: | git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" - git add ct/*.app + git add ./ct/*.app git commit -m "Update .app files" + # Create a temporary branch for the PR git checkout -b pr-update-app-files git push origin pr-update-app-files --force @@ -65,6 +72,12 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Step 7: Output success message when no changes + - name: No changes detected + if: steps.verify-diff.outputs.changed == 'false' + run: echo "No changes to commit. Workflow completed successfully." + + - name: Re-approve pull request after update if: steps.verify-diff.outputs.changed == 'true' env: