Skip to content

Commit 9ebd8c9

Browse files
committed
renovate: Use GitHub app to retrieve a token
As Renovate will run with a different token, there is no need for specific workflow permissions anymore. Instead the GitHub app should have sufficient permissions to create a PullRequest on the repo. See https://github.com/actions/create-github-app-token/blob/main/README.md on instructions how to add the GitHub App. Please note we need to configure following on the repo settings: variable RENOVATE_APP_ID secret RENOVATE_PRIVATE_KEY I named it specific like this so we can dedicate this app specifically to Renovate and therefore also keep permissions limited to the Renovate usecase. Signed-off-by: Marco Franssen <[email protected]>
1 parent 7582c38 commit 9ebd8c9

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

.github/workflows/renovate.yaml

+7-5
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,23 @@ jobs:
1515
renovate:
1616
runs-on: ubuntu-latest
1717

18-
permissions:
19-
contents: write
20-
pull-requests: write
21-
2218
steps:
2319
- name: Checkout
2420
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2521

22+
- uses: actions/create-github-app-token@3ff1caaa28b64c9cc276ce0a02e2ff584f3900c5 # v2.0.2
23+
id: app-token
24+
with:
25+
app-id: ${{ vars.RENOVATE_APP_ID }}
26+
private-key: ${{ secrets.RENOVATE_PRIVATE_KEY }}
27+
2628
- name: Self-hosted Renovate
2729
uses: renovatebot/github-action@e084b5ac6fd201023db6dd7743aec023babb02c8 # v41.0.13
2830
with:
2931
configurationFile: ".github/renovate-config.js"
3032
token: "${{ secrets.GITHUB_TOKEN }}"
3133
env:
3234
LOG_LEVEL: ${{ env.ACTIONS_STEP_DEBUG == 'true' && 'debug' || 'info' }}
33-
RENOVATE_REPOSITORIES: ${{ github.repository }}
35+
RENOVATE_REPOSITORIES: ${{ steps.app-token.outputs.token }}
3436
RENOVATE_ALLOW_SCRIPTS: true
3537
RENOVATE_SEPARATE_MAJOR_MINOR: false

0 commit comments

Comments
 (0)