| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- name: "opencode GitHub Action"
- description: "Run opencode in GitHub Actions workflows"
- branding:
- icon: "code"
- color: "orange"
- inputs:
- model:
- description: "Model to use"
- required: true
- share:
- description: "Share the opencode session (defaults to true for public repos)"
- required: false
- prompt:
- description: "Custom prompt to override the default prompt"
- required: false
- runs:
- using: "composite"
- steps:
- - name: Get opencode version
- id: version
- shell: bash
- run: |
- VERSION=$(curl -sf https://api.github.com/repos/sst/opencode/releases/latest | grep -o '"tag_name": *"[^"]*"' | cut -d'"' -f4)
- echo "version=${VERSION:-latest}" >> $GITHUB_OUTPUT
- - name: Cache opencode
- id: cache
- uses: actions/cache@v4
- with:
- path: ~/.opencode/bin
- key: opencode-${{ runner.os }}-${{ runner.arch }}-${{ steps.version.outputs.version }}
- - name: Install opencode
- if: steps.cache.outputs.cache-hit != 'true'
- shell: bash
- run: curl -fsSL https://opencode.ai/install | bash
- - name: Add opencode to PATH
- shell: bash
- run: echo "$HOME/.opencode/bin" >> $GITHUB_PATH
- - name: Run opencode
- shell: bash
- id: run_opencode
- run: opencode github run
- env:
- MODEL: ${{ inputs.model }}
- SHARE: ${{ inputs.share }}
- PROMPT: ${{ inputs.prompt }}
|