Skip to content

Commit dbc2e72

Browse files
committed
conditionally commit and push gc-reports updates
Add checks to ensure changes exist before committing and pushing updates in the gc-reports workflow. This avoids unnecessary commits and streamlines report synchronization logic.
1 parent a667aaa commit dbc2e72

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

.github/workflows/gc-reports.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,25 @@ jobs:
3333
3434
- run: git pull --ff-only
3535
- run: git add -A reports
36+
37+
- name: Check for changes
38+
id: check_changes
39+
shell: bash
40+
run: |
41+
if git diff --cached --quiet; then
42+
echo "has_changes=false" >> "$GITHUB_OUTPUT"
43+
else
44+
echo "has_changes=true" >> "$GITHUB_OUTPUT"
45+
fi
46+
3647
- run: "git commit -m 'gc-reports: prune old reports'"
48+
if: steps.check_changes.outputs.has_changes == 'true'
49+
3750
- run: git push
51+
if: steps.check_changes.outputs.has_changes == 'true'
3852

3953
- name: Trigger Web workflow
40-
if: github.ref == 'refs/heads/main'
54+
if: github.ref == 'refs/heads/main' && steps.check_changes.outputs.has_changes == 'true'
4155
run: gh workflow run web.yml --ref "${{ github.ref }}"
4256
env:
4357
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)