diff --git a/.github/workflows/generate-3dmodel.yml b/.github/workflows/generate-3dmodel.yml new file mode 100644 index 0000000..9aeee63 --- /dev/null +++ b/.github/workflows/generate-3dmodel.yml @@ -0,0 +1,43 @@ +name: Generate Missing 3D Models + +on: + issue_comment: + types: [created] + +jobs: + generate-3d: + if: github.event.issue.pull_request && contains(github.event.comment.body, '/generate-3dmodel') + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + + steps: + - uses: actions/checkout@v4 + with: + ref: refs/pull/${{ github.event.issue.number }}/head + + - name: Generate 3D Models + run: | + echo "Generating 3D models..." + kicad-actions generate-3d --board path/to/board.kicad_pcb + + - name: Commit generated models + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add 3dmodel/* + git commit -m "Auto-generated 3D models" + git push + + - name: Comment completion + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + await github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: "✅ 3D models generated and committed." + });