Skip to content

Commit 45ca310

Browse files
authored
fix(ci): use GitHub App token for releases with bypass permissions (#340)
Add support for GitHub App authentication to bypass organization-level tag creation rulesets. The workflow now: 1. Generates a GitHub App installation token using app credentials 2. Falls back to RELEASE_TOKEN (PAT) if app not configured 3. Falls back to GITHUB_TOKEN for backward compatibility Priority: GitHub App > PAT > GITHUB_TOKEN Setup: - RELEASE_APP_ID: GitHub App ID (2514085) - RELEASE_APP_PRIVATE_KEY: App private key (PEM format) - App must be configured as bypass actor in org rulesets This enables automated releases without manual tag creation.
1 parent 33eca2d commit 45ca310

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

.github/workflows/semver-release.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,26 +68,36 @@ jobs:
6868
issues: write # Required for GitHub releases
6969

7070
steps:
71+
# Generate GitHub App token with bypass permissions for tag creation
72+
- name: Generate GitHub App token
73+
id: app-token
74+
uses: actions/create-github-app-token@v1
75+
with:
76+
app-id: ${{ secrets.RELEASE_APP_ID }}
77+
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
78+
# Fallback to RELEASE_TOKEN (PAT) or GITHUB_TOKEN if app credentials not configured
79+
continue-on-error: true
80+
7181
- uses: actions/checkout@v6
7282
with:
7383
fetch-depth: 0
74-
# Use RELEASE_TOKEN (PAT/App token with bypass permissions) if available, fallback to GITHUB_TOKEN
75-
token: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
84+
# Priority: GitHub App token > RELEASE_TOKEN (PAT) > GITHUB_TOKEN
85+
token: ${{ steps.app-token.outputs.token || secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
7686

7787
- name: Python Semantic Release
7888
id: semantic
7989
uses: python-semantic-release/python-semantic-release@v10.5.2
8090
with:
81-
# Use RELEASE_TOKEN to bypass tag creation restrictions
82-
github_token: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
91+
# Use GitHub App token with bypass permissions
92+
github_token: ${{ steps.app-token.outputs.token || secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
8393
verbosity: "2"
8494
# Don't create GitHub release here - we'll create a draft below
8595
vcs_release: "false"
8696

8797
- name: Create draft GitHub release
8898
if: steps.semantic.outputs.released == 'true'
8999
env:
90-
GH_TOKEN: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
100+
GH_TOKEN: ${{ steps.app-token.outputs.token || secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
91101
run: |
92102
VERSION="${{ steps.semantic.outputs.version }}"
93103
TAG="v${VERSION}"

0 commit comments

Comments
 (0)