Skip to content

Commit a91008a

Browse files
ci: bumpversion action improvements
1. Permissions — permissions: {} at workflow level, scoped contents: write + pull-requests: write to the job. 2. Concurrency guard — group: bumpversion, cancel-in-progress: false so a second trigger waits rather than interrupting mid-bump. 3. Pre-commit fix — removed the "Configure Git" and "Create version commit" steps; create-pull-request now owns the commit via commit-message.
1 parent 8d1ff4d commit a91008a

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

.github/workflows/bumpversion.yml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ run-name: Bump version (${{ inputs.bump-type }}) by @${{ github.actor }}
66
# Note: Enable GitHub Actions to create pull requests in repository settings:
77
# Settings -> Actions -> General -> Workflow permissions -> Allow GitHub Actions to create and approve pull requests
88

9-
permissions:
10-
contents: write
11-
pull-requests: write
9+
permissions: {}
10+
11+
concurrency:
12+
group: bumpversion
13+
cancel-in-progress: false
1214

1315
on:
1416
workflow_dispatch:
@@ -31,6 +33,9 @@ on:
3133
jobs:
3234
bump_version:
3335
runs-on: ubuntu-latest
36+
permissions:
37+
contents: write
38+
pull-requests: write
3439

3540
outputs:
3641
version: ${{ steps.bump.outputs.current-version }}
@@ -75,24 +80,11 @@ jobs:
7580
command: query
7681
version: latest
7782

78-
- name: Configure Git
79-
id: git_setup
80-
run: |
81-
# Configure Git user
82-
git config --global user.name "${{ github.actor }}"
83-
git config --global user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
84-
85-
- name: Create version commit
86-
id: create_commit
87-
run: |
88-
git add .
89-
git commit -m "chore: Increase version to ${{ steps.bump.outputs.current-version }} (${{ inputs.bump-type }} bump)"
90-
echo "::notice::Commit created, will be pushed via pull request"
91-
9283
- name: Create Pull Request
9384
id: create_pr
9485
uses: peter-evans/create-pull-request@v7
9586
with:
87+
commit-message: "chore: bump version to ${{ steps.bump.outputs.current-version }} (${{ inputs.bump-type }} bump)"
9688
title: "Bump version to ${{ steps.bump.outputs.current-version }} (${{ inputs.bump-type }} bump)"
9789
body: |
9890
This PR **${{ inputs.bump-type }}** bumps the version to `${{ steps.bump.outputs.current-version }}` and updates the changelog.

0 commit comments

Comments
 (0)