generate.yml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. - name: Setup Bun
  18. uses: ./.github/actions/setup-bun
  19. - name: Setup git committer
  20. id: committer
  21. uses: ./.github/actions/setup-git-committer
  22. with:
  23. opencode-app-id: ${{ vars.OPENCODE_APP_ID }}
  24. opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }}
  25. - name: Generate
  26. run: ./script/generate.ts
  27. - name: Commit and push
  28. run: |
  29. if [ -z "$(git status --porcelain)" ]; then
  30. echo "No changes to commit"
  31. exit 0
  32. fi
  33. git add -A
  34. git commit -m "chore: generate" --allow-empty
  35. git push origin HEAD:${{ github.ref_name }} --no-verify
  36. # if ! git push origin HEAD:${{ github.event.pull_request.head.ref || github.ref_name }} --no-verify; then
  37. # echo ""
  38. # echo "============================================"
  39. # echo "Failed to push generated code."
  40. # echo "Please run locally and push:"
  41. # echo ""
  42. # echo " ./script/generate.ts"
  43. # echo " git add -A && git commit -m \"chore: generate\" && git push"
  44. # echo ""
  45. # echo "============================================"
  46. # exit 1
  47. # fi