summaryrefslogtreecommitdiffhomepage
path: root/sdks/github/action.yml
blob: 8501ce09885075a7e84f910952bc7b17ef718abd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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

outputs:
  share_url:
    description: "URL to share the opencode execution"
    value: ${{ steps.run_opencode.outputs.share_url }}

runs:
  using: "composite"
  steps:
    - name: Setup Node.js
      uses: actions/setup-node@v4
      with:
        node-version: 22

    - name: Install Bun
      uses: oven-sh/setup-bun@v2
      with:
        bun-version: 1.2.16

    - name: Install Dependencies
      shell: bash
      run: |
        cd ${GITHUB_ACTION_PATH}
        bun install

    - name: Install opencode
      shell: bash
      run: curl -fsSL https://opencode.ai/install | bash

    - name: Run opencode
      shell: bash
      id: run_opencode
      run: |
        bun run ${GITHUB_ACTION_PATH}/src/index.ts
      env:
        INPUT_MODEL: ${{ inputs.model }}
        INPUT_SHARE: ${{ inputs.share }}

    #- name: Testing
    #  shell: bash
    #  run: |
    #    gh pr comment ${{ github.event.number }} --body "This is an automated comment"
    #  env:
    #    GH_TOKEN: ${{ github.token }}