generate.yml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. git add -A
  33. git commit -m "chore: generate"
  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