diff --git a/.github/workflows/update-contributors.yml b/.github/workflows/update-contributors.yml new file mode 100644 index 0000000000..a83a804807 --- /dev/null +++ b/.github/workflows/update-contributors.yml @@ -0,0 +1,48 @@ +name: Update Contributors + +on: + push: + branches: + - main + workflow_dispatch: # Allows manual triggering + +jobs: + update-contributors: + runs-on: ubuntu-latest + permissions: + contents: write # Needed for pushing changes + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Update contributors + run: npm run update-contributors + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Check for changes + id: check-changes + run: | + if [[ -n "$(git status --porcelain README.md)" ]]; then + echo "changes=true" >> $GITHUB_OUTPUT + else + echo "No changes to README.md" + fi + + - name: Commit and push changes + if: steps.check-changes.outputs.changes == 'true' + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git add README.md + git commit -m "docs: update contributors list [skip ci]" + git push \ No newline at end of file