From 210c85de412cd8f3e93c48cf682e6acb71fb873e Mon Sep 17 00:00:00 2001 From: Brice Schaffner Date: Thu, 21 Apr 2022 10:57:37 +0200 Subject: [PATCH] Do a patch increase in case of a bug-* branch detection --- .github/workflows/pr-auto-semver.yml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pr-auto-semver.yml b/.github/workflows/pr-auto-semver.yml index 6ac37f9..df42e7d 100644 --- a/.github/workflows/pr-auto-semver.yml +++ b/.github/workflows/pr-auto-semver.yml @@ -27,15 +27,17 @@ jobs: pr-release-title: name: Set PR title runs-on: ubuntu-latest - if: ${{ github.base_ref == 'master' }} steps: - - uses: actions/checkout@v2 + - name: Checkout master branch + uses: actions/checkout@v2 + if: ${{ github.base_ref == 'master' }} with: fetch-depth: 0 - ref: master + ref: ${{ github.base_ref }} # This step is needed in order for the geoadmin/github-tag-action@master action to work properly - name: Do the merge but don't push it + if: ${{ github.base_ref == 'master' }} run: | cd ${GITHUB_WORKSPACE} git config user.email "github@swisstopo.ch" @@ -55,15 +57,10 @@ jobs: # Set default bump type for hotfixes case "${{ github.head_ref }}" in - hotfix-* | bugfix-* | bug-*) + fix-* | hotfix-* | bugfix-* | bug-*) bump_type=patch echo "Hotfix detected set default bump to ${bump_type}" ;; - - feat-* | feature-*) - bump_type=minor - echo "Hotfix detected set default bump to ${bump_type}" - ;; esac echo "Set bump type based on PR infos" @@ -87,6 +84,7 @@ jobs: echo "::set-output name=pr_title::${pr_title}" - name: Bump version (without tagging) + if: ${{ github.base_ref == 'master' }} id: get_tag uses: geoadmin/github-tag-action@master env: @@ -98,15 +96,15 @@ jobs: DRY_RUN: true - name: Set `New Release` PR title if needed - if: ${{ github.head_ref == 'develop' }} + if: ${{ github.head_ref == 'develop' && github.base_ref == 'master' }} uses: juztcode/pr-updater@1.0.0 with: token: ${{ secrets.GITHUB_TOKEN }} title: "New Release ${{ steps.get_tag.outputs.new_tag }} - #${{ steps.bump_type.outputs.bump }}" body: ${{ steps.pr_infos.outputs.body }} - - name: Set `Hotfix` PR title if needed - if: ${{ github.head_ref != 'develop' }} + - name: Set Bump type in PR title if needed + if: ${{ github.head_ref != 'master' && github.base_ref == 'develop' }} uses: juztcode/pr-updater@1.0.0 with: token: ${{ secrets.GITHUB_TOKEN }}