Skip to content

Commit e79bf5d

Browse files
authored
Merge pull request #2 from deploymenttheory/ci/release-please-app
ci(release-please): authenticate with the org's release-please App
2 parents b188b79 + 9aff1cb commit e79bf5d

1 file changed

Lines changed: 32 additions & 2 deletions

File tree

.github/workflows/release-please.yml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,37 @@ jobs:
2020
with:
2121
egress-policy: audit
2222

23-
- uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0
23+
# The org's release-please GitHub App rather than a personal token: the
24+
# token is minted per run and expires in an hour, and it belongs to the
25+
# org rather than to whoever created the PAT — a PAT dies with its
26+
# owner's access and takes every repo's releases with it.
27+
#
28+
# actions:write is the load-bearing permission. Tags pushed with the
29+
# default GITHUB_TOKEN deliberately do not trigger workflows, which
30+
# would leave every release tagged and unbuilt; the App can.
31+
#
32+
# continue-on-error keeps releases working where the App is not yet
33+
# installed or its key is not provisioned: the next step falls back to
34+
# the PAT and says so, because a silent fallback is how a repo ends up
35+
# believing it uses the App when it never has.
36+
- uses: actions/create-github-app-token@v2
37+
id: app-token
38+
if: ${{ vars.RP_APP_ID != '' }}
39+
continue-on-error: true
2440
with:
41+
app-id: ${{ vars.RP_APP_ID }}
42+
private-key: ${{ secrets.RP_APP_PRIVATE_KEY }}
43+
44+
- name: Which credential
45+
run: |
46+
if [ -n "${{ steps.app-token.outputs.token }}" ]; then
47+
echo "release-please is using the org's release-please App"
48+
else
49+
echo "::warning::App token unavailable (RP_APP_ID/RP_APP_PRIVATE_KEY unset, or the App is not installed here) — falling back to the repo PAT"
50+
fi
51+
52+
- uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
53+
with:
54+
# Set this to match the repo: go | simple | terraform-module | node | …
2555
release-type: terraform-module
26-
token: ${{ secrets.RELEASE_PLEASE_PAT }}
56+
token: ${{ steps.app-token.outputs.token || secrets.RELEASE_PLEASE_PAT }}

0 commit comments

Comments
 (0)