update-contributors.yml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. name: Update Contributors
  2. on:
  3. push:
  4. branches:
  5. - main
  6. workflow_dispatch: # Allows manual triggering
  7. jobs:
  8. update-contributors:
  9. runs-on: ubuntu-latest
  10. permissions:
  11. contents: write # Needed for pushing changes
  12. steps:
  13. - name: Checkout code
  14. uses: actions/checkout@v3
  15. - name: Setup Node.js
  16. uses: actions/setup-node@v3
  17. with:
  18. node-version: '18'
  19. cache: 'npm'
  20. - name: Install dependencies
  21. run: npm ci
  22. - name: Update contributors and check for changes
  23. run: |
  24. npm run update-contributors
  25. git diff --quiet README.md || echo "changes=true" >> $GITHUB_OUTPUT
  26. id: check-changes
  27. env:
  28. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  29. - name: Stage changes
  30. if: steps.check-changes.outputs.changes == 'true'
  31. run: |
  32. git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
  33. git config --local user.name "github-actions[bot]"
  34. git add README.md
  35. git commit -m "docs: update contributors list [skip ci]"
  36. - name: Create Pull Request
  37. if: steps.check-changes.outputs.changes == 'true'
  38. uses: peter-evans/create-pull-request@v5
  39. with:
  40. token: ${{ secrets.GITHUB_TOKEN }}
  41. title: "Update contributors list"
  42. body: |
  43. Automated update of contributors list in README.md
  44. This PR was created automatically by a GitHub Action workflow.
  45. branch: update-contributors
  46. branch-suffix: timestamp
  47. delete-branch: true
  48. base: main