Skip to content

Commit 13a12bc

Browse files
authored
chore: Reactivate update-contributors workflow (#4344)
* chore: Reactivate update-contributors workflow * Set git user properly
1 parent efb1734 commit 13a12bc

File tree

2 files changed

+61
-32
lines changed

2 files changed

+61
-32
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Update Contributors in README
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 1-7 * SUN'
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
id-token: write
11+
12+
jobs:
13+
update-contributors:
14+
if: github.repository == 'grafana/pyroscope'
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
19+
with:
20+
persist-credentials: 'false'
21+
- id: get-secrets
22+
uses: grafana/shared-workflows/actions/get-vault-secrets@28361cdb22223e5f1e34358c86c20908e7248760
23+
with:
24+
repo_secrets: |
25+
GITHUB_APP_ID=pyroscope-development-app:app-id
26+
GITHUB_APP_INSTALLATION_ID=pyroscope-development-app:app-installation-id
27+
GITHUB_APP_PRIVATE_KEY=pyroscope-development-app:private-key
28+
29+
- name: Generate token
30+
id: generate_token
31+
uses: actions/create-github-app-token@3ff1caaa28b64c9cc276ce0a02e2ff584f3900c5 # v2.0.2
32+
with:
33+
app-id: ${{ env.GITHUB_APP_ID }}
34+
private-key: ${{ env.GITHUB_APP_PRIVATE_KEY }}
35+
owner: ${{ github.repository_owner }}
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+
- uses: actions/setup-go@v5
46+
with:
47+
go-version: 1.23.11
48+
- name: Update contributors
49+
run: make update-contributors
50+
51+
- name: Commit and push changes
52+
run: |
53+
APP_BOT="${{ steps.generate_token.outputs.app-slug }}[bot]"
54+
git config --local user.name "${APP_BOT}"
55+
git config --local user.email "${{ steps.get-user-id.outputs.user-id }}+${APP_BOT}@users.noreply.github.com"
56+
if ! git diff --exit-code README.md; then
57+
git add README.md
58+
git commit -m 'docs: updates the list of contributors in README'
59+
gh auth status
60+
git push --force https://x-access-token:${{ steps.generate_token.outputs.token }}@github.com/${{ github.repository }}.git HEAD:main 2> /dev/null
61+
fi

.github/workflows_disabled/update-contributors.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)