From 4275a24272cea0f5a0f76c722e248b6725cc8003 Mon Sep 17 00:00:00 2001 From: nccanderson Date: Tue, 17 Mar 2026 16:14:42 -0700 Subject: [PATCH 1/2] Create PR instead of pushing directly to protected main branch Also adds pull-requests permission and uses gh CLI to create the PR. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/version-bump.yaml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/version-bump.yaml b/.github/workflows/version-bump.yaml index 5734d74..7079571 100644 --- a/.github/workflows/version-bump.yaml +++ b/.github/workflows/version-bump.yaml @@ -15,6 +15,7 @@ name: version-bump permissions: contents: write + pull-requests: write jobs: bump-version: @@ -44,14 +45,17 @@ jobs: cat(sprintf("new_version=%s\n", version), file = Sys.getenv("GITHUB_OUTPUT")) shell: Rscript {0} - - name: Commit and tag + - name: Create PR with version bump run: | + BRANCH="version-bump/${{ steps.bump.outputs.new_version }}" git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - git add DESCRIPTION NEWS.md || git add DESCRIPTION + git checkout -b "$BRANCH" + git add -A git commit -m "Bump version to ${{ steps.bump.outputs.new_version }}" - if [ "${{ inputs.bump }}" != "dev" ]; then - git tag "v${{ steps.bump.outputs.new_version }}" - fi - git push - git push --tags + git push -u origin "$BRANCH" + gh pr create \ + --title "Bump version to ${{ steps.bump.outputs.new_version }}" \ + --body "Automated ${{ inputs.bump }} version bump to ${{ steps.bump.outputs.new_version }}." + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From c1248ea50e01151d83680860381560b11cdef503 Mon Sep 17 00:00:00 2001 From: nccanderson Date: Tue, 17 Mar 2026 16:18:49 -0700 Subject: [PATCH 2/2] Use PAT to push version bumps directly to main Switches from GITHUB_TOKEN to VERSION_BUMP_TOKEN (a PAT) to bypass branch protection. Pushes directly to main with a version tag instead of creating a PR. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/version-bump.yaml | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/.github/workflows/version-bump.yaml b/.github/workflows/version-bump.yaml index 7079571..bf6c0c9 100644 --- a/.github/workflows/version-bump.yaml +++ b/.github/workflows/version-bump.yaml @@ -15,7 +15,6 @@ name: version-bump permissions: contents: write - pull-requests: write jobs: bump-version: @@ -24,7 +23,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.VERSION_BUMP_TOKEN }} - uses: r-lib/actions/setup-r@v2 with: @@ -45,17 +44,14 @@ jobs: cat(sprintf("new_version=%s\n", version), file = Sys.getenv("GITHUB_OUTPUT")) shell: Rscript {0} - - name: Create PR with version bump + - name: Commit, tag, and push run: | - BRANCH="version-bump/${{ steps.bump.outputs.new_version }}" git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - git checkout -b "$BRANCH" git add -A git commit -m "Bump version to ${{ steps.bump.outputs.new_version }}" - git push -u origin "$BRANCH" - gh pr create \ - --title "Bump version to ${{ steps.bump.outputs.new_version }}" \ - --body "Automated ${{ inputs.bump }} version bump to ${{ steps.bump.outputs.new_version }}." - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + if [ "${{ inputs.bump }}" != "dev" ]; then + git tag "v${{ steps.bump.outputs.new_version }}" + fi + git push + git push --tags