generate.yml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. name: generate
  2. on:
  3. push:
  4. branches:
  5. - dev
  6. - v2
  7. jobs:
  8. generate:
  9. runs-on: blacksmith-4vcpu-ubuntu-2404
  10. permissions:
  11. contents: write
  12. pull-requests: write
  13. steps:
  14. - name: Checkout repository
  15. uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
  16. - name: Setup Bun
  17. uses: ./.github/actions/setup-bun
  18. - name: Setup git committer
  19. id: committer
  20. uses: ./.github/actions/setup-git-committer
  21. with:
  22. opencode-app-id: ${{ vars.OPENCODE_APP_ID }}
  23. opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }}
  24. - name: Generate
  25. run: ./script/generate.ts
  26. - name: Commit and push
  27. run: |
  28. if [ -z "$(git status --porcelain)" ]; then
  29. echo "No changes to commit"
  30. exit 0
  31. fi
  32. git add -A
  33. git commit -m "chore: generate" --allow-empty
  34. git push origin HEAD:${{ github.ref_name }} --no-verify
  35. # if ! git push origin HEAD:${{ github.event.pull_request.head.ref || github.ref_name }} --no-verify; then
  36. # echo ""
  37. # echo "============================================"
  38. # echo "Failed to push generated code."
  39. # echo "Please run locally and push:"
  40. # echo ""
  41. # echo " ./script/generate.ts"
  42. # echo " git add -A && git commit -m \"chore: generate\" && git push"
  43. # echo ""
  44. # echo "============================================"
  45. # exit 1
  46. # fi