mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-10-30 19:03:25 +01:00
Added auto editing of Top Contributors
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
name: Update Contributors
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
workflow_dispatch: {}
|
||||
|
||||
jobs:
|
||||
update-contributors:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Get contributors (PR authors)
|
||||
run: |
|
||||
gh api repos/${{ github.repository }}/pulls \
|
||||
--paginate --jq '.[] | select(.merged_at != null) | .user.login' > merged_authors.txt
|
||||
|
||||
sort merged_authors.txt | uniq -c | sort -nr > contributors_count.txt
|
||||
|
||||
- name: Build Markdown table
|
||||
run: |
|
||||
echo "| Contributor | PRs Merged | Highlights |" > stars_table.md
|
||||
echo "| ----------- | ---------- | ---------- |" >> stars_table.md
|
||||
|
||||
while read count author; do
|
||||
echo "| @$author | $count | Awesome contributions! |" >> stars_table.md
|
||||
done < contributors_count.txt
|
||||
|
||||
- name: Update CONTRIBUTORS.md
|
||||
run: |
|
||||
awk '
|
||||
BEGIN { in_block=0 }
|
||||
/<!-- STARS_TABLE_START -->/ { print; print system("cat stars_table.md"); in_block=1; next }
|
||||
/<!-- STARS_TABLE_END -->/ { in_block=0 }
|
||||
in_block==0 { print }
|
||||
' CONTRIBUTORS.md > CONTRIBUTORS.new.md
|
||||
|
||||
mv CONTRIBUTORS.new.md CONTRIBUTORS.md
|
||||
|
||||
- name: Commit changes
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "Update community stars"
|
||||
Reference in New Issue
Block a user