generate.yml 1.7 KB

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