Skip to content

Commit

Permalink
better bump check scripr
Browse files Browse the repository at this point in the history
  • Loading branch information
gpmayorga committed Dec 20, 2024
1 parent 2a0e8f0 commit a9d62a3
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,20 @@ jobs:

- name: Check if version was already bumped
id: version_check
# if: github.event.review.state == 'approved'
run: |
if [ "${{ github.event_name }}" == "pull_request_review" ]; then
# Find the commit where the branch diverged from main
git fetch origin main
MERGE_BASE=$(git merge-base origin/main HEAD)
# Check commits between merge-base and current HEAD
COMMITS=$(git log $MERGE_BASE..HEAD --format=%B)
if echo "$COMMITS" | grep -q "\[bot\] New pkg version:"; then
VERSION_COMMIT=$(echo "$COMMITS" | grep "\[bot\] New pkg version:" | head -n 1)
echo "::warning::Version was already bumped in this branch with commit message: $VERSION_COMMIT"
echo "skip_bump=true" >> $GITHUB_OUTPUT
else
echo "No version bump found in branch commits"
echo "skip_bump=false" >> $GITHUB_OUTPUT
fi
# Find the commit where the branch diverged from main
git fetch origin main
MERGE_BASE=$(git merge-base origin/main HEAD)
# Check commits between merge-base and current HEAD
COMMITS=$(git log $MERGE_BASE..HEAD --format=%B)
if echo "$COMMITS" | grep -q "\[bot\] New pkg version:"; then
VERSION_COMMIT=$(echo "$COMMITS" | grep "\[bot\] New pkg version:" | head -n 1)
echo "::warning::Version was already bumped in this branch with commit message: $VERSION_COMMIT"
echo "skip_bump=true" >> $GITHUB_OUTPUT
else
echo "No version bump found in branch commits"
echo "skip_bump=false" >> $GITHUB_OUTPUT
fi
Expand Down

0 comments on commit a9d62a3

Please sign in to comment.