Skip to content

Commit

Permalink
Add GitHub Action to update README with contributors, update
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhagarwal1 committed Oct 5, 2024
1 parent b2019d1 commit 3aac190
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/update-contributors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Update Contributors in README

on:
push:
branches:
- main

jobs:
update-contributors:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install GitHub CLI
run: |
sudo apt-get install gh
- name: Fetch contributors
id: get_contributors
run: |
CONTRIBUTORS=$(gh api repos/${{ github.repository }}/contributors --jq '.[].login' | tr '\n' ', ')
echo "CONTRIBUTORS=${CONTRIBUTORS}" >> $GITHUB_ENV
- name: Update README
run: |
echo "## Contributors" >> README.md
echo "${{ env.CONTRIBUTORS }}" >> README.md
- name: Commit changes
run: |
git config --local user.name "GitHub Action"
git config --local user.email "action@github.com"
git add README.md
git commit -m "Update README with contributors" || echo "No changes to commit"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 3aac190

Please sign in to comment.