Skip to content

Commit 31dce22

Browse files
authored
fix: use github app to update-make-docs workflow (#4548)
* fix: use github nodes to update-make-docs workflow * Revert "fix: use github nodes to update-make-docs workflow" This reverts commit fe1dea1. * Keep auth * add write permission * Allow PR creation * Use app token instead * Fix url setting
1 parent 6ac069f commit 31dce22

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

.github/workflows/update-make-docs.yml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,48 @@ on:
99
jobs:
1010
main:
1111
if: github.repository == 'grafana/pyroscope'
12+
permissions:
13+
contents: read
14+
id-token: write
1215
runs-on: ${{ github.repository_owner == 'grafana' && 'ubuntu-x64-small' || 'ubuntu-latest' }}
1316
steps:
1417
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1518
with:
16-
persist-credentials: false
19+
persist-credentials: 'false'
20+
- id: get-secrets
21+
uses: grafana/shared-workflows/actions/get-vault-secrets@50003525a2bfea2f21a7dcec5fc67ab22690d19d
22+
with:
23+
repo_secrets: |
24+
GITHUB_APP_ID=pyroscope-development-app:app-id
25+
GITHUB_APP_INSTALLATION_ID=pyroscope-development-app:app-installation-id
26+
GITHUB_APP_PRIVATE_KEY=pyroscope-development-app:private-key
27+
- name: Generate token
28+
id: generate_token
29+
uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
30+
with:
31+
app-id: ${{ env.GITHUB_APP_ID }}
32+
private-key: ${{ env.GITHUB_APP_PRIVATE_KEY }}
33+
owner: ${{ github.repository_owner }}
34+
permission-contents: write
35+
permission-pull-requests: write
36+
repositories: |
37+
pyroscope
38+
- name: Get GitHub App User ID
39+
id: get-user-id
40+
env:
41+
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
42+
run: |
43+
APP_BOT="${{ steps.generate_token.outputs.app-slug }}[bot]"
44+
echo "user-id=$(gh api "/users/${APP_BOT}" --jq .id)" >> "$GITHUB_OUTPUT"
45+
- name: Configure git remote
46+
run: |
47+
APP_BOT="${{ steps.generate_token.outputs.app-slug }}[bot]"
48+
git config --local user.name "${APP_BOT}"
49+
git config --local user.email "${{ steps.get-user-id.outputs.user-id }}+${APP_BOT}@users.noreply.github.com"
50+
git remote set-url "origin" https://x-access-token:${{ steps.generate_token.outputs.token }}@github.com/${{ github.repository }}.git > /dev/null 2> /dev/null
1751
- uses: grafana/writers-toolkit/update-make-docs@d87843b53c21125598f5e20e5bebae213f0059b6
1852
with:
1953
pr_options: >
2054
--label type/docs
55+
token: ${{ steps.generate_token.outputs.token }}
2156
trace: true

0 commit comments

Comments
 (0)