Skip to content

Commit cd44711

Browse files
authored
fix(workflow): use shared contributors workflow (#26)
1 parent 1c46e47 commit cd44711

File tree

1 file changed

+4
-35
lines changed

1 file changed

+4
-35
lines changed

.github/workflows/contributors.yml

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,10 @@ name: Update Contributors
22

33
on:
44
schedule:
5-
- cron: '0 0 * * *' # Run daily at midnight UTC
6-
workflow_dispatch: # Allow manual trigger
5+
- cron: '0 0 * * *'
6+
workflow_dispatch:
77

88
jobs:
99
contributors:
10-
runs-on: ubuntu-latest
11-
steps:
12-
- uses: actions/checkout@v4
13-
with:
14-
token: ${{ secrets.CONTRIBUTORS_TOKEN }}
15-
16-
- name: Update contributors
17-
env:
18-
GH_TOKEN: ${{ secrets.CONTRIBUTORS_TOKEN }}
19-
run: |
20-
# Fetch contributors from GitHub API (exclude bots)
21-
contributors=$(gh api repos/CodingWithCalvin/VS-OpenInNotepadPlusPlus/contributors --paginate --jq '.[] | select(.type != "Bot") | select(.login | test("\\[bot\\]$") | not) | "<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)
10+
uses: CodingWithCalvin/.github/.github/workflows/contributors.yml@main
11+
secrets: inherit

0 commit comments

Comments
 (0)