diff --git a/.github/workflows/update-contributors.yml b/.github/workflows/update-contributors.yml new file mode 100644 index 0000000..a19dd1e --- /dev/null +++ b/.github/workflows/update-contributors.yml @@ -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 } + // { print; print system("cat stars_table.md"); in_block=1; next } + // { 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" diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 64e4d96..68706a4 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -15,9 +15,11 @@ Want to see your name here? [Open a PR](https://github.com/Vateron-Media/XC_VM/p ## 🌟 Community Stars *(Top Contributors)* + | Contributor | PRs Merged | Highlights | | ----------- | ---------- | -------------------- | | *None yet* | — | Waiting for your PR! | + --- @@ -25,7 +27,7 @@ Want to see your name here? [Open a PR](https://github.com/Vateron-Media/XC_VM/p ### 💻 Code -* *No code contributions yet* +* [@gpechieu](https://github.com/gpechieu) — Fixing bugs and adding features ### 📖 Documentation