Skip to content

Commit

Permalink
end gracefully if there are no changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Dec 24, 2024
1 parent 9ab4dd3 commit aff9542
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/maintenance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,22 @@ jobs:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0

- name: Check for differences
id: check-diff
run: |
git fetch origin main
if git diff --quiet origin/main ${{ needs.create-branch-prefix.outputs.base-branch }}; then
echo "No differences found between branches"
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "Changes detected"
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
- name: Create Pull Request
if: steps.check-diff.outputs.has_changes == 'true'
env:
GH_TOKEN: ${{ secrets.LASTMJS_GITHUB_TOKEN }}
run: |
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/squash_branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,14 @@ jobs:
git merge --squash $branch
done
# Create a merge commit with a descriptive message
git commit -am "${{ inputs.commit-message }}"
git push origin HEAD:$CURRENT_BRANCH
# Check if there are any changes to commit
if git diff --staged --quiet; then
echo "No changes to commit"
else
# Create a merge commit with a descriptive message
git commit -am "${{ inputs.commit-message }}"
git push origin HEAD:$CURRENT_BRANCH
fi
- name: Delete branches
run: |
Expand Down

0 comments on commit aff9542

Please sign in to comment.