Skip to content

Commit c7af847

Browse files
feat: let release please open its pull request as a github app
A pull request opened with GITHUB_TOKEN starts no workflow, so the checks on the release pull request wait on a manual approval and turn red when it expires. An app token gives the pull request a real identity and the checks run on their own. Optional: a repository without RELEASE_APP_ID and RELEASE_APP_PRIVATE_KEY falls back to GITHUB_TOKEN and releases exactly as before.
1 parent a5215a8 commit c7af847

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

‎.github/workflows/app-release.yml‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88
context:
99
type: string
1010
required: true
11+
secrets:
12+
RELEASE_APP_ID:
13+
required: false
14+
RELEASE_APP_PRIVATE_KEY:
15+
required: false
1116

1217
permissions: {}
1318

@@ -23,9 +28,27 @@ jobs:
2328
tag: ${{ steps.release.outputs.tag_name }}
2429
version: ${{ steps.release.outputs.version }}
2530
steps:
31+
# a pull request opened with GITHUB_TOKEN starts no workflow of its own —
32+
# github blocks that so a bot cannot trigger itself — so the checks on the
33+
# release pull request wait for a human to approve them and go red when
34+
# they expire. A github app token makes the pull request come from a real
35+
# identity and the checks simply run.
36+
#
37+
# Optional on purpose: a project that has not set the secrets up still
38+
# releases exactly as before, it just needs that click. Read through env
39+
# rather than testing `secrets` directly, which is not available to `if`.
40+
- id: app-token
41+
if: ${{ env.APP_ID != '' }}
42+
env:
43+
APP_ID: ${{ secrets.RELEASE_APP_ID }}
44+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
45+
with:
46+
app-id: ${{ secrets.RELEASE_APP_ID }}
47+
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
2648
- id: release
2749
uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
2850
with:
51+
token: ${{ steps.app-token.outputs.token || github.token }}
2952
config-file: release-please-config.json
3053
manifest-file: .release-please-manifest.json
3154

0 commit comments

Comments
 (0)