File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,13 +10,33 @@ jobs:
1010 runs-on : ubuntu-latest
1111 steps :
1212 - uses : actions/checkout@v4
13+ with :
14+ token : ${{ secrets.CONTRIBUTORS_TOKEN }}
1315
1416 - name : Update contributors
15- uses : akhilmhdh/contributors-readme-action@v2.3.2
1617 env :
17- GITHUB_TOKEN : ${{ secrets.CONTRIBUTORS_TOKEN }}
18- with :
19- image_size : 64
20- columns_per_row : 8
21- commit_message : ' docs: update contributors [skip ci]'
22- auto_detect_branch_protection : false
18+ GH_TOKEN : ${{ secrets.CONTRIBUTORS_TOKEN }}
19+ run : |
20+ # Fetch contributors from GitHub API
21+ contributors=$(gh api repos/dtvem/dtvem/contributors --paginate --jq '.[] | "<a href=\"\(.html_url)\"><img src=\"\(.avatar_url)\" width=\"64\" height=\"64\" alt=\"\(.login)\"/></a>"')
22+
23+ # Build the contributors section
24+ contrib_section="<!-- readme: contributors -start -->
25+ <p align=\"left\">
26+ $contributors
27+ </p>
28+ <!-- readme: contributors -end -->"
29+
30+ # Update README between the markers
31+ awk -v contrib="$contrib_section" '
32+ /<!-- readme: contributors -start -->/{found=1; print contrib; next}
33+ /<!-- readme: contributors -end -->/{found=0; next}
34+ !found{print}
35+ ' README.md > README.tmp && mv README.tmp README.md
36+
37+ - name : Commit and push
38+ run : |
39+ git config user.name "github-actions[bot]"
40+ git config user.email "github-actions[bot]@users.noreply.github.com"
41+ git add README.md
42+ git diff --staged --quiet || (git commit -m "docs: update contributors [skip ci]" && git push)
You can’t perform that action at this time.
0 commit comments