From 03c7de525efd8060585e0372a2d87c7c6ffcf3bb Mon Sep 17 00:00:00 2001 From: Alan Janis Date: Fri, 9 Aug 2024 00:01:42 -0600 Subject: [PATCH 1/3] Update tag_on_merge.yml --- .github/workflows/tag_on_merge.yml | 39 ++++++++++++++++++------------ 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/.github/workflows/tag_on_merge.yml b/.github/workflows/tag_on_merge.yml index c37b39d..f80455b 100644 --- a/.github/workflows/tag_on_merge.yml +++ b/.github/workflows/tag_on_merge.yml @@ -1,34 +1,41 @@ ---- # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions name: Tag on Merge on: - push: + pull_request: branches: - - main - master + types: + - closed env: CI: true +permissions: write-all + jobs: - build: + version_tag: + if: github.event.pull_request.merged == true + env: + BUMP: |- + ${{ + contains(github.event.pull_request.labels.*.name, 'major') && 'major' + || contains(github.event.pull_request.labels.*.name, 'minor') && 'minor' + || 'patch' + }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Bump version and push tag - uses: anothrNick/github-tag-action@1.36.0 + - uses: actions/checkout@v3 + with: + ref: master + fetch-tags: true + - name: Bump version and get tag + id: new_version + uses: anothrNick/github-tag-action@1.67.0 env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - WITH_V: true - DEFAULT_BUMP: minor - - name: Push changes - uses: ad-m/github-push-action@master - if: steps.commit.outputs.exit_code == 0 - with: - github_token: ${{ secrets.GH_TOKEN }} - force: true - branch: ${{ github.ref }} + WITH_V: 'true' + DEFAULT_BUMP: ${{ env.BUMP }} From 2d8aae690c6ce6129407c696789bf9c9bfaab1e1 Mon Sep 17 00:00:00 2001 From: Alan Janis Date: Fri, 9 Aug 2024 00:02:29 -0600 Subject: [PATCH 2/3] Create request-pr-label.yml --- .github/workflows/request-pr-label.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/request-pr-label.yml diff --git a/.github/workflows/request-pr-label.yml b/.github/workflows/request-pr-label.yml new file mode 100644 index 0000000..6d50b21 --- /dev/null +++ b/.github/workflows/request-pr-label.yml @@ -0,0 +1,22 @@ +name: 'PR Open: Request Label' +on: + pull_request: + branches: + - master + types: + - opened +jobs: + add_comment: + if: >- + !contains(github.event.pull_request.labels.*.name, 'major') && + !contains(github.event.pull_request.labels.*.name, 'minor') && + !contains(github.event.pull_request.labels.*.path, 'patch') + name: Comment requesting versioning label + runs-on: ubuntu-latest + steps: + - uses: mshick/add-pr-comment@v1 + with: + message: + Please set a versioning label of either `major`, `minor`, or `patch` + to the pull request. + repo-token: ${{ secrets.GH_TOKEN }} From bd914a13cfac18ef4e0a335acb591630526debf2 Mon Sep 17 00:00:00 2001 From: Alan Janis Date: Fri, 9 Aug 2024 00:03:28 -0600 Subject: [PATCH 3/3] Create pr-label-checker.yml --- .github/workflows/pr-label-checker.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/pr-label-checker.yml diff --git a/.github/workflows/pr-label-checker.yml b/.github/workflows/pr-label-checker.yml new file mode 100644 index 0000000..df315a8 --- /dev/null +++ b/.github/workflows/pr-label-checker.yml @@ -0,0 +1,24 @@ +name: PR Label - Checker +on: + pull_request: + branches: + - master + types: + - reopened + - labeled + - unlabeled + - edited + - synchronize +jobs: + check_labels: + name: Check PR Versioning Labels + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: mheap/github-action-required-labels@v1 + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + with: + mode: exactly + count: 1 + labels: major, minor, patch