Skip to content

Legacy multiline search #24

Legacy multiline search

Legacy multiline search #24

name: Display the version hint
on:
pull_request:
types: [synchronize, opened, reopened, ready_for_review]
branches: [master]
jobs:
preview-version-hint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Checkout the repository
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
token: ${{ secrets.PAT }}
- name: Setup Python and Git
uses: ./.github/actions/setup-python-and-git
with:
python-version: '3.11'
- name: Install requirements
run: |
python -m pip install generate-changelog bump-my-version
- name: Get the release hint
id: generate-changelog
run: |
RELEASE_KIND=$(generate-changelog --output release-hint --branch-override ${{ github.base_ref }} --skip-output-pipeline)
echo "::notice::Suggested release type upon merge to ${{ github.base_ref }}: ${RELEASE_KIND}"
echo "RELEASE_KIND=$RELEASE_KIND" >> $GITHUB_ENV
echo "release-kind=$RELEASE_KIND" >> $GITHUB_OUTPUT
- name: Get Pull Request Number
id: pr
run: |
PR_NUMBER=$(gh pr view --json number -q .number || echo "${{ github.event.number }}")
echo "pull_request_number=${PR_NUMBER}" >> $GITHUB_OUTPUT
echo "::notice::PR_NUMBER is ${PR_NUMBER}"
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
- name: Bump version dry run
if: ${{ env.RELEASE_KIND != 'no-release' }}
shell: bash
run: |
# This will display a full log of what would happen if we were to bump the version.
bump-my-version bump --dry-run --verbose "$RELEASE_KIND"
# This retrieves the current and new version numbers as a JSON-formatted string.
VERSION_INFO=$(bump-my-version show --format json --increment "$RELEASE_KIND" current_version new_version)
echo "CURRENT_VERSION=$(echo $VERSION_INFO | jq -r .current_version)" >> $GITHUB_ENV
echo "NEW_VERSION=$(echo $VERSION_INFO | jq -r .new_version)" >> $GITHUB_ENV
- name: Set no-release information
if: ${{ env.RELEASE_KIND == 'no-release' }}
run: |
echo "CURRENT_VERSION=$(bump-my-version show current_version)" >> $GITHUB_ENV
echo "NEW_VERSION=$(bump-my-version show current_version)" >> $GITHUB_ENV
- name: Display the version hint
uses: s-gehring/singleton-comment@v1
with:
comment-body: |
**Version hint:** ${{ env.RELEASE_KIND }}
**Current version:** ${{ env.CURRENT_VERSION }}
**New version (when merged):** ${{ env.NEW_VERSION }}