fix: use GitHub App token for release PR creation (#31)
The org blocks GITHUB_TOKEN from creating pull requests
("Write permissions for workflows are disabled by the organization").
Switch to a GitHub App installation token generated via
actions/create-github-app-token for the PR creation step.
Requires org-level secrets RELEASE_APP_ID and RELEASE_APP_PRIVATE_KEY
to be configured. Calling workflows must pass these secrets.
Closes #30
Co-authored-by: Hugh Hackman <hugh@privilegedescalation.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
d733a720af
commit
453e320f35
@@ -17,6 +17,13 @@ on:
|
|||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
default: ''
|
default: ''
|
||||||
|
secrets:
|
||||||
|
RELEASE_APP_ID:
|
||||||
|
description: 'GitHub App ID for creating PRs (org blocks GITHUB_TOKEN from creating PRs)'
|
||||||
|
required: true
|
||||||
|
RELEASE_APP_PRIVATE_KEY:
|
||||||
|
description: 'GitHub App private key (PEM format)'
|
||||||
|
required: true
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
@@ -150,6 +157,13 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Generate GitHub App token
|
||||||
|
id: app-token
|
||||||
|
uses: actions/create-github-app-token@v1
|
||||||
|
with:
|
||||||
|
app-id: ${{ secrets.RELEASE_APP_ID }}
|
||||||
|
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
|
||||||
|
|
||||||
- name: Install GitHub CLI
|
- name: Install GitHub CLI
|
||||||
run: |
|
run: |
|
||||||
if ! command -v gh &>/dev/null; then
|
if ! command -v gh &>/dev/null; then
|
||||||
@@ -173,4 +187,4 @@ jobs:
|
|||||||
--head "release/v${VERSION}"
|
--head "release/v${VERSION}"
|
||||||
gh pr merge "release/v${VERSION}" --auto --squash --delete-branch
|
gh pr merge "release/v${VERSION}" --auto --squash --delete-branch
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||||
|
|||||||
Reference in New Issue
Block a user