diff --git a/.github/actions/opencode/actions b/.github/actions/opencode/actions new file mode 100644 index 00000000..c5044c48 --- /dev/null +++ b/.github/actions/opencode/actions @@ -0,0 +1,33 @@ +name: "opencode GitHub Action" +description: "Run opencode in GitHub Actions workflows" +branding: + icon: "code" + color: "orange" + +inputs: + model: + description: "Model to use" + required: false + + share: + description: "Share the opencode session (defaults to true for public repos)" + required: false + + prompt: + description: "Prompt to run" + required: false + +runs: + using: "composite" + steps: + - name: Install opencode + shell: bash + run: curl -fsSL https://opencode.ai/install | bash + + - name: Run opencode + shell: bash + id: run_opencode + run: opencode run -p "${{ inputs.prompt }}" || true + env: + MODEL: ${{ inputs.model }} + SHARE: ${{ inputs.share }} diff --git a/.github/workflows/opencode.yml b/.github/workflows/opencode.yml index 50fb7361..698208ae 100644 --- a/.github/workflows/opencode.yml +++ b/.github/workflows/opencode.yml @@ -4,6 +4,17 @@ on: issue_comment: types: [created] + pull_request: + + pull_request_comment: + types: [created] + + pull_request_review: + types: [submitted] + + pull_request_review_comment: + types: [created] + jobs: opencode: if: | @@ -21,7 +32,17 @@ jobs: - name: Run opencode uses: sst/opencode/github@latest + if: github.event_name != 'pull_request' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + model: github-copilot/gpt-4.1 + + - name: Run opencode (for pull request) + uses: ./github/actions/opencode + if: github.event_name == 'pull_request' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: model: github-copilot/gpt-4.1 + prompt: ${{ github.event.comment.body }}