Skip to content

Commit bb38393

Browse files
fix: Enhance bump-patch workflow with token generation and improved Git configuration for version bumping through a GitHub App
1 parent cc8e276 commit bb38393

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

.github/workflows/bump-patch.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,20 @@ jobs:
99
bump-patch:
1010
name: Bump patch version (Poetry)
1111
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
1214
steps:
15+
- name: Generate token
16+
id: generate_token
17+
uses: actions/create-github-app-token@v1
18+
with:
19+
app_id: ${{ secrets.VERSION_BUMP_APP_ID }}
20+
private_key: ${{ secrets.VERSION_BUMP_APP_TOKEN }}
21+
1322
- uses: actions/checkout@v4
1423
with:
1524
fetch-depth: 0
25+
token: ${{ steps.generate_token.outputs.token }}
1626

1727
- name: Install uv
1828
run: curl -LsSf https://astral.sh/uv/install.sh | sh
@@ -27,10 +37,15 @@ jobs:
2737
echo "VERSION=$(uv run --no-sync poetry version -s)" >> $GITHUB_OUTPUT
2838
2939
- name: Commit & push changes
40+
env:
41+
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
3042
run: |
31-
git config user.name "github-actions"
32-
git config user.email "actions@github.com"
43+
git config user.name "${{ secrets.VERSION_BUMP_APP_ID }}[bot]"
44+
git config user.email "${{ secrets.VERSION_BUMP_APP_ID }}[bot]@users.noreply.github.com"
45+
3346
git add pyproject.toml
3447
git commit -m "ci: bump patch version to v${{ steps.bump_version.outputs.VERSION }} [skip ci]" || echo "No changes"
3548
git tag v${{ steps.bump_version.outputs.VERSION }} || echo "Tag exists"
49+
50+
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git"
3651
git push origin HEAD:develop --follow-tags

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "it-tools-api"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
description = "API for IT Tools"
55
authors = [
66
{ name = "Anton Dmytrenko", email = "48_decorum.row@icloud.com" },

0 commit comments

Comments
 (0)