Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,30 @@ jobs:
- name: Push changes
run: |
git push --follow-tags
- name: "Install Poetry"
run: pip install poetry
Copy link

Copilot AI Apr 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] To ensure consistency in build environments, consider specifying a particular version of Poetry when installing.

Suggested change
run: pip install poetry
run: pip install poetry==1.5.1

Copilot uses AI. Check for mistakes.
- name: "Determine version bump type"
run: |
git fetch --tags
# This defaults to a patch type, unless a feature commit was pushed, then set type to minor
LAST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
LAST_COMMIT=$(git log -1 --format='%H')
Comment on lines +46 to +47
Copy link

Copilot AI Apr 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding error handling or a default value in case no tags are found. Without this, an empty LAST_TAG may lead to unexpected behavior in the version bump logic.

Suggested change
LAST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
LAST_COMMIT=$(git log -1 --format='%H')
LAST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1) 2>/dev/null || echo "v0.0.0")
LAST_COMMIT=$(git log -1 --format='%H')
if [ "$LAST_TAG" = "v0.0.0" ]; then
echo "No tags found. Defaulting LAST_TAG to v0.0.0"
fi

Copilot uses AI. Check for mistakes.
echo "Last git tag: $LAST_TAG"
echo "Last git commit: $LAST_COMMIT"
echo "Commits:"
git log --no-merges --pretty=oneline $LAST_TAG...$LAST_COMMIT
git log --no-merges --pretty=format:"%s" $LAST_TAG...$LAST_COMMIT | grep -q ^feat: && BUMP_TYPE="minor" || BUMP_TYPE="patch"
echo "Version bump type: $BUMP_TYPE"
echo "BUMP_TYPE=$BUMP_TYPE" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Version bump"
run: |
poetry version $BUMP_TYPE
- name: "Push new version"
run: |
git add pyproject.toml
git commit -m "Update version to $(poetry version -s)"
git push origin HEAD:${{ github.event.pull_request.head.ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}