update-contributors.yml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. name: Update Contributors
  2. on:
  3. push:
  4. branches:
  5. - main
  6. workflow_dispatch: # Allows manual triggering
  7. env:
  8. NODE_VERSION: 20.18.1
  9. PNPM_VERSION: 10.8.1
  10. jobs:
  11. update-contributors:
  12. runs-on: ubuntu-latest
  13. permissions:
  14. contents: write # Needed for pushing changes
  15. pull-requests: write # Needed for creating PRs
  16. steps:
  17. - name: Checkout code
  18. uses: actions/checkout@v4
  19. - name: Install pnpm
  20. uses: pnpm/action-setup@v4
  21. with:
  22. version: ${{ env.PNPM_VERSION }}
  23. - name: Setup Node.js
  24. uses: actions/setup-node@v4
  25. with:
  26. node-version: ${{ env.NODE_VERSION }}
  27. cache: 'pnpm'
  28. - name: Disable Husky
  29. run: |
  30. echo "HUSKY=0" >> $GITHUB_ENV
  31. git config --global core.hooksPath /dev/null
  32. - name: Install dependencies
  33. run: pnpm install
  34. - name: Update contributors and format
  35. run: |
  36. pnpm update-contributors
  37. npx prettier --write README.md
  38. if git diff --quiet; then echo "changes=false" >> $GITHUB_OUTPUT; else echo "changes=true" >> $GITHUB_OUTPUT; fi
  39. id: check-changes
  40. env:
  41. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  42. - name: Create Pull Request
  43. if: steps.check-changes.outputs.changes == 'true'
  44. uses: peter-evans/create-pull-request@v5
  45. with:
  46. token: ${{ secrets.GITHUB_TOKEN }}
  47. commit-message: "docs: update contributors list [skip ci]"
  48. committer: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
  49. branch: update-contributors
  50. delete-branch: true
  51. title: "Update contributors list"
  52. body: |
  53. Automated update of contributors list and related files
  54. This PR was created automatically by a GitHub Action workflow and includes all changed files.
  55. base: main