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. pull-requests: write # Needed for creating PRs
  13. steps:
  14. - name: Checkout code
  15. uses: actions/checkout@v4
  16. - name: Setup Node.js
  17. uses: actions/setup-node@v4
  18. with:
  19. node-version: '18'
  20. cache: 'npm'
  21. - name: Disable Husky
  22. run: |
  23. echo "HUSKY=0" >> $GITHUB_ENV
  24. git config --global core.hooksPath /dev/null
  25. - name: Install dependencies
  26. run: npm ci
  27. - name: Update contributors and format
  28. run: |
  29. npm run update-contributors
  30. npx prettier --write README.md
  31. if git diff --quiet; then echo "changes=false" >> $GITHUB_OUTPUT; else echo "changes=true" >> $GITHUB_OUTPUT; fi
  32. id: check-changes
  33. env:
  34. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  35. - name: Create Pull Request
  36. if: steps.check-changes.outputs.changes == 'true'
  37. uses: peter-evans/create-pull-request@v5
  38. with:
  39. token: ${{ secrets.GITHUB_TOKEN }}
  40. commit-message: "docs: update contributors list [skip ci]"
  41. committer: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
  42. branch: update-contributors
  43. delete-branch: true
  44. title: "Update contributors list"
  45. body: |
  46. Automated update of contributors list and related files
  47. This PR was created automatically by a GitHub Action workflow and includes all changed files.
  48. base: main