From 5c33504343b149ad8856f97177c54983b15f858e Mon Sep 17 00:00:00 2001 From: Kasper Thystrup Karstensen Date: Mon, 3 Aug 2026 15:38:05 +0200 Subject: [PATCH 1/3] Update GitHub Actions workflow for version bump --- .github/workflows/VERSION.yml | 65 +++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/.github/workflows/VERSION.yml b/.github/workflows/VERSION.yml index e021c50..073aa23 100644 --- a/.github/workflows/VERSION.yml +++ b/.github/workflows/VERSION.yml @@ -1,51 +1,58 @@ -name: Automatic version bump +name: Bump and Merge on: - workflow_run: - workflows: ["Pull Request Validation"] - types: [completed] pull_request: - types: [closed] - -permissions: - contents: write + types: [labeled] jobs: - bump: - if: github.event.pull_request.merged == true - + bump-and-merge: + # Only run if both a version label and a merge trigger label are present + if: | + contains(github.event.pull_request.labels.*.name, 'trigger-merge') && ( + contains(github.event.pull_request.labels.*.name, 'major') || + contains(github.event.pull_request.labels.*.name, 'feature') || + contains(github.event.pull_request.labels.*.name, 'patch') + ) runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write steps: - - uses: actions/checkout@v4 - with: - ref: dev - - - uses: actions/setup-python@v5 + - name: Checkout PR Branch + uses: actions/checkout@v4 with: - python-version: "3.12" + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.ref }} - - name: Get label + - name: Extract Label id: label run: | echo "LABEL=${{ contains(github.event.pull_request.labels.*.name, 'major') && 'major' || contains(github.event.pull_request.labels.*.name, 'feature') && 'feature' || - contains(github.event.pull_request.labels.*.name, 'patch') && 'patch' || - 'build' + 'patch' }}" >> $GITHUB_OUTPUT - - name: Bump version + - name: Bump Version run: | - python .github/scripts/bump_version.py \ - "${{ steps.label.outputs.LABEL }}" + python .github/scripts/bump_version.py "${{ steps.label.outputs.LABEL }}" - - name: Commit + - name: Commit and Push to PR run: | - git config user.name github-actions - git config user.email github-actions@github.com - + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" git add . - git commit -m "Bump version" + git commit -m "chore(release): bump version before merge [skip ci]" git push - + + - name: Automatically Merge PR + uses: actions/github-script@v7 + with: + script: | + github.rest.pulls.merge({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + merge_method: 'squash' # or 'merge' / 'rebase' + }) From d2b499a147bdddfec00032a240a5bdab37be0ba3 Mon Sep 17 00:00:00 2001 From: Kasper Thystrup Karstensen Date: Mon, 3 Aug 2026 15:55:02 +0200 Subject: [PATCH 2/3] Enhance version bump conditions with 'build' label Added support for 'build' label in version bump conditions. --- .github/workflows/VERSION.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/VERSION.yml b/.github/workflows/VERSION.yml index 073aa23..ee0fc75 100644 --- a/.github/workflows/VERSION.yml +++ b/.github/workflows/VERSION.yml @@ -8,10 +8,11 @@ jobs: bump-and-merge: # Only run if both a version label and a merge trigger label are present if: | - contains(github.event.pull_request.labels.*.name, 'trigger-merge') && ( + contains(github.event.pull_request.labels.*.name, 'merge') && ( contains(github.event.pull_request.labels.*.name, 'major') || contains(github.event.pull_request.labels.*.name, 'feature') || - contains(github.event.pull_request.labels.*.name, 'patch') + contains(github.event.pull_request.labels.*.name, 'patch') || + contains(github.event.pull_request.labels.*.name, 'build') ) runs-on: ubuntu-latest permissions: From 18bd27e53aa09bf7cdf407a34363c49ab2577110 Mon Sep 17 00:00:00 2001 From: Kasper Thystrup Karstensen Date: Mon, 3 Aug 2026 16:01:48 +0200 Subject: [PATCH 3/3] Implement check-and-label job for PR comments Added a new job to check and label PR comments for merging. --- .github/workflows/COMMENTS.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/COMMENTS.yml b/.github/workflows/COMMENTS.yml index dd31965..7ea9c44 100644 --- a/.github/workflows/COMMENTS.yml +++ b/.github/workflows/COMMENTS.yml @@ -89,3 +89,31 @@ jobs: issue_number, body: `✅ Version label set to **${label}**` }); + + check-and-label: + # 1. Must be a PR comment (not a plain issue) + # 2. Comment must contain the command (e.g., /merge or trigger-merge) + # 3. User MUST be an OWNER, MEMBER, or COLLABORATOR + if: | + github.event.issue.pull_request != null && + contains(github.event.comment.body, '/merge') && ( + github.event.comment.author_association == 'OWNER' || + github.event.comment.author_association == 'MEMBER' || + github.event.comment.author_association == 'COLLABORATOR' + ) + runs-on: ubuntu-latest + permissions: + pull-requests: write + issues: write + + steps: + - name: Add merge label + uses: actions/github-script@v7 + with: + script: | + github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + labels: ['merge'] + })