Skip to content

Commit ec7facf

Browse files
authored
feat: use a GitHub App instead of a personal account for release-plz (#10)
Signed-off-by: Esteve Fernandez <[email protected]>
1 parent 8d1f73f commit ec7facf

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

.github/workflows/release-plz.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,29 @@ jobs:
1313
permissions:
1414
contents: write
1515
steps:
16+
# Generating a GitHub token, so that PRs and tags created by
17+
# the release-plz-action can trigger actions workflows.
18+
- name: Generate GitHub token
19+
uses: actions/create-github-app-token@v2
20+
id: generate-token
21+
with:
22+
# GitHub App ID secret name
23+
app-id: ${{ secrets.APP_ID }}
24+
# GitHub App private key secret name
25+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
1626
- name: Checkout repository
1727
uses: actions/checkout@v4
1828
with:
1929
fetch-depth: 0
20-
token: ${{ secrets.RELEASE_PLZ_TOKEN }}
30+
token: ${{ steps.generate-token.outputs.token }}
2131
- name: Install Rust toolchain
2232
uses: dtolnay/rust-toolchain@stable
2333
- name: Run release-plz
2434
uses: release-plz/[email protected]
2535
with:
2636
command: release
2737
env:
28-
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
38+
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
2939
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
3040

3141
release-plz-pr:
@@ -39,17 +49,27 @@ jobs:
3949
group: release-plz-${{ github.ref }}
4050
cancel-in-progress: false
4151
steps:
52+
# Generating a GitHub token, so that PRs and tags created by
53+
# the release-plz-action can trigger actions workflows.
54+
- name: Generate GitHub token
55+
uses: actions/create-github-app-token@v2
56+
id: generate-token
57+
with:
58+
# GitHub App ID secret name
59+
app-id: ${{ secrets.APP_ID }}
60+
# GitHub App private key secret name
61+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
4262
- name: Checkout repository
4363
uses: actions/checkout@v4
4464
with:
4565
fetch-depth: 0
46-
token: ${{ secrets.RELEASE_PLZ_TOKEN }}
66+
token: ${{ steps.generate-token.outputs.token }}
4767
- name: Install Rust toolchain
4868
uses: dtolnay/rust-toolchain@stable
4969
- name: Run release-plz
5070
uses: release-plz/[email protected]
5171
with:
5272
command: release-pr
5373
env:
54-
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
74+
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
5575
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

0 commit comments

Comments
 (0)