| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- 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
- use_github_token:
- description: "Use GITHUB_TOKEN directly instead of OpenCode App token exchange. When true, skips OIDC and uses the GITHUB_TOKEN env var."
- required: false
- default: "false"
- mentions:
- description: "Comma-separated list of trigger phrases (case-insensitive). Defaults to '/opencode,/oc'"
- required: false
- oidc_base_url:
- description: "Base URL for OIDC token exchange API. Only required when running a custom GitHub App install. Defaults to https://api.opencode.ai"
- 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 }}
- USE_GITHUB_TOKEN: ${{ inputs.use_github_token }}
- MENTIONS: ${{ inputs.mentions }}
- OIDC_BASE_URL: ${{ inputs.oidc_base_url }}
|