Skip to content

Commit 1c008a1

Browse files
authored
diff check
1 parent 3cea72c commit 1c008a1

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

.github/workflows/auto-update-app-headers.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,27 @@ jobs:
3939
env:
4040
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4141

42-
# Step 5: Check for changes
42+
# Step 5: Check if there are any changes
4343
- name: Check if there are any changes
4444
id: verify-diff
4545
run: |
46-
git diff --quiet . || echo "changed=true" >> $GITHUB_OUTPUT
46+
if git diff --quiet; then
47+
echo "No changes detected."
48+
echo "changed=false" >> $GITHUB_OUTPUT
49+
else
50+
echo "Changes detected."
51+
echo "changed=true" >> $GITHUB_OUTPUT
52+
fi
4753
4854
# Step 6: Commit changes (if any) and create a PR
4955
- name: Commit and create PR if changes exist
5056
if: steps.verify-diff.outputs.changed == 'true'
5157
run: |
5258
git config --global user.name "github-actions[bot]"
5359
git config --global user.email "github-actions[bot]@users.noreply.github.com"
54-
git add ct/*.app
60+
git add ./ct/*.app
5561
git commit -m "Update .app files"
62+
# Create a temporary branch for the PR
5663
git checkout -b pr-update-app-files
5764
git push origin pr-update-app-files --force
5865
@@ -65,6 +72,12 @@ jobs:
6572
env:
6673
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6774

75+
# Step 7: Output success message when no changes
76+
- name: No changes detected
77+
if: steps.verify-diff.outputs.changed == 'false'
78+
run: echo "No changes to commit. Workflow completed successfully."
79+
80+
6881
- name: Re-approve pull request after update
6982
if: steps.verify-diff.outputs.changed == 'true'
7083
env:

0 commit comments

Comments
 (0)