update-contributors.yml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. name: Update Contributors
  2. on:
  3. push:
  4. branches:
  5. - main
  6. workflow_dispatch:
  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 and pnpm
  17. uses: ./.github/actions/setup-node-pnpm
  18. - name: Disable Husky
  19. run: |
  20. echo "HUSKY=0" >> $GITHUB_ENV
  21. git config --global core.hooksPath /dev/null
  22. - name: Update contributors and format
  23. run: |
  24. pnpm update-contributors
  25. npx prettier --write README.md
  26. if git diff --quiet; then echo "changes=false" >> $GITHUB_OUTPUT; else echo "changes=true" >> $GITHUB_OUTPUT; fi
  27. id: check-changes
  28. env:
  29. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  30. - name: Create Pull Request
  31. if: steps.check-changes.outputs.changes == 'true'
  32. uses: peter-evans/create-pull-request@v5
  33. with:
  34. token: ${{ secrets.GITHUB_TOKEN }}
  35. commit-message: "docs: update contributors list [skip ci]"
  36. committer: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
  37. branch: update-contributors
  38. delete-branch: true
  39. title: "Update contributors list"
  40. body: |
  41. Automated update of contributors list and related files
  42. This PR was created automatically by a GitHub Action workflow and includes all changed files.
  43. base: main