ci: grant pull-requests:write to Release (v2) and (v3) workflows#422
Conversation
The `release / create_release` job (reusable workflow `OneSignal/sdk-shared/.github/workflows/create-release.yml`) calls `gh pr create`, which failed with `Resource not accessible by integration (createPullRequest)` because the caller workflow only granted `contents: write`. Reusable workflows cannot expand permissions beyond what the caller provides, so the token reached the job without `pull-requests: write`. Add it at the workflow scope so all jobs in the release pipeline can create/update PRs.
There was a problem hiding this comment.
LGTM — one-line permissions fix matching the cited failure mode.
Extended reasoning...
Overview
This PR adds a single line — pull-requests: write — to the top-level permissions block of .github/workflows/release.yml. The motivation is documented with the exact failing log line from the v3.9.0 release dispatch, and matches GitHub Actions' standard requirement for gh pr create in the reusable create-release.yml workflow.
Security risks
Permissions are widened only for the dispatch-triggered Release (v3) workflow, which is already a privileged maintainer-initiated flow. pull-requests: write allows the workflow's GITHUB_TOKEN to create/update PRs in this repo — appropriate for a release pipeline. No secret handling, no third-party code, no runtime/plugin code touched.
Level of scrutiny
Low. This is a mechanical CI permissions change, matches the established lockstep pattern with PRs #420 and #421, and follows the principle-of-least-privilege bump that the cited error explicitly requires. There is no logic to review.
Other factors
The bug hunter flagged a pre-existing parallel gap in release-v2.yml (also missing pull-requests: write); that inline comment is already attached and the author can decide whether to fold it into this PR or a follow-up. It doesn't block approval of the v3 fix, which is correct as written.
`release-v2.yml` has the same structural issue as `release.yml`: its `release` job calls the reusable `OneSignal/sdk-shared/.github/workflows/create-release.yml`, which runs `gh pr create`. With only `contents: write` on the caller, the next v2 release dispatch would fail with the same `Resource not accessible by integration (createPullRequest)` error. Restore the v2/v3 lockstep maintained by #420 and #421.
There was a problem hiding this comment.
LGTM — both v2 and v3 callers now grant pull-requests: write, addressing the lockstep concern from my prior comment.
Extended reasoning...
Overview
This PR adds pull-requests: write to the top-level permissions block in both .github/workflows/release.yml (v3) and .github/workflows/release-v2.yml (v2). The change is two identical one-line additions. Both workflows invoke the reusable OneSignal/sdk-shared/.github/workflows/create-release.yml@main, which runs gh pr create and therefore requires pull-requests: write on the caller token (reusable workflows can only narrow, never expand, caller permissions).
Security risks
None of concern. The change only grants a workflow-scoped GITHUB_TOKEN the ability to create/update pull requests, and only on workflow_dispatch runs of the release pipelines — these are manually triggered by maintainers, not by external PR contributors. No new secrets, no new untrusted inputs, no expansion of what code runs.
Level of scrutiny
Low. This is a minimal, mechanical CI permissions tweak that follows the established pattern from companion PRs #420 and #421, which patched v2 and v3 in lockstep. The fix is the documented remedy for the exact Resource not accessible by integration (createPullRequest) error from the v3.9.0 release run.
Other factors
My prior comment on this PR flagged that release-v2.yml had the same structural gap and recommended bundling the fix here to preserve the v2/v3 lockstep. The current diff now includes both files (commit aed68ef adds the v2 line on top of cfcc98c's v3 line), so that concern is resolved. No bugs were reported by the bug hunting system on the latest revision, and there are no outstanding reviewer comments.
One Line Summary
Add
pull-requests: writeto both theRelease (v3)andRelease (v2)workflows so the reusablecreate_releasejob can open the release PR.Motivation
The most recent
Release (v3)run (for v3.9.0) failed at therelease / create_releasestep with:The job log shows the token reached the job with only:
That job invokes
OneSignal/sdk-shared/.github/workflows/create-release.yml@main, which callsgh pr create. A reusable workflow can only ever narrow — never expand — the caller's permissions, so the lack ofpull-requests: writeon the caller (.github/workflows/release.yml) prevents the reusable workflow from creating the release PR.release-v2.ymlhas the identical structural issue (same reusable workflow, same missing permission), so a futureRelease (v2)dispatch would fail with the same error. Patched in lockstep, matching the convention established by #420 and #421.Companion to #420, which fixed the analogous permissions/token issue for the
prep / prepare_releasejob in both workflows but did not addpull-requests: write.Scope
.github/workflows/release.yml(Release (v3)) and.github/workflows/release-v2.yml(Release (v2)). All jobs in both pipelines now run withpull-requests: write. Only thereleasejob needs it forgh pr create; the others are unaffected by the broader scope.sdk-shared, any other workflow in this repo.Testing
Manual
Actions → Release (v3) → Run workflowagainstmainwithversion: 3.9.0(the in-flight release).release / create_releasejob no longer errors atgh pr createand that PRchore: Release 3.9.0is created/updated againstmain.release-v2.ymlwhen the next v2 patch is dispatched.Note: because
rel/3.9.0and thechore(release): v3.9.0bump commit already exist from the previous failed run, the re-dispatch will rebase the existing branch and runbumpagain. Thesed-based edits inbump-versionare idempotent, but theawkstep that inserts a new= 3.9.0 =block intoreadme.txtis not — expect a duplicate changelog entry that may need to be cleaned up onrel/3.9.0before the release PR is merged. Will file a follow-up to makebump-versionidempotent.Unit / Integration
composer testpasses locally — N/A, workflow-only change.Affected code checklist
v3/)v2/legacy codereadme.txt, etc.)Checklist
readme.txtand plugin version bumped if user-facing (release PRs only) — N/A