Skip to content

Commit 320a99a

Browse files
OgeonX-AiAitomates
andauthored
fix(release): support optional PAT for release-please PR creation (#24)
* fix(release): support optional PAT for release-please PR creation Root cause of all-repo Release Please failures: the default GITHUB_TOKEN cannot create pull requests when a repository's Settings > Actions > General > Workflow permissions > "Allow GitHub Actions to create and approve pull requests" toggle is disabled. release-please-action fails atomically with: ##[error]release-please failed: GitHub Actions is not permitted to create or approve pull requests. Because this happens inside the single manifest run, the already-merged release commit's tag/GitHub Release is never created either — hence 'gh release list' returning empty even after 'chore(main): release 1.0.0' PRs were merged. The repeated 'commit could not be parsed' messages for merge-commit and free-text subjects are pre-existing, non-fatal release-please warnings (excluded from the changelog by design) — not the cause of failure. Confirmed via API on autogen, .github, and cas-platform: can_approve_pull_request_reviews: false This adds an optional 'release-please-token' secret input to the reusable workflow, passed through to the action as 'token:', falling back to github.token when unset. This lets callers opt into a scoped PAT / GitHub App installation token (which is not subject to the Actions PR-creation restriction) without requiring the broader, org-wide 'Allow Actions to create/approve PRs' setting to be enabled. Backward compatible: no behavior change for existing pinned callers until they (a) repin to a commit that includes this fix and (b) pass a token via 'secrets: release-please-token' or 'secrets: inherit'. * fix(release): pass PAT to release-please self-caller --------- Co-authored-by: Kim Harjamäki <kim.harjamaki@prosimo.fi>
1 parent 2f2ed17 commit 320a99a

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

.github/workflows/release-please-reusable.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
name: Release Please (reusable)
22
on:
33
workflow_call:
4+
secrets:
5+
release-please-token:
6+
description: >
7+
Optional PAT / GitHub App installation token used to create the
8+
release-please pull request and GitHub Release. Required when the
9+
calling repository has "Allow GitHub Actions to create and approve
10+
pull requests" disabled (Settings > Actions > General > Workflow
11+
permissions) — the default GITHUB_TOKEN cannot open pull requests
12+
in that case and release-please-action fails with:
13+
"GitHub Actions is not permitted to create or approve pull
14+
requests."
15+
Falls back to the default GITHUB_TOKEN when unset, preserving
16+
existing behavior for repos that already allow Actions to create
17+
PRs.
18+
required: false
419
jobs:
520
release-please:
621
runs-on: ubuntu-latest
@@ -12,5 +27,6 @@ jobs:
1227
steps:
1328
- uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
1429
with:
30+
token: ${{ secrets.release-please-token || github.token }}
1531
config-file: release-please-config.json
1632
manifest-file: .release-please-manifest.json

.github/workflows/release-please.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ jobs:
1010
pull-requests: write
1111
issues: write
1212
uses: ./.github/workflows/release-please-reusable.yml
13+
secrets:
14+
release-please-token: ${{ secrets.RELEASE_PLEASE_TOKEN }}

0 commit comments

Comments
 (0)