summaryrefslogtreecommitdiffhomepage
path: root/github/action.yml
diff options
context:
space:
mode:
authorSachnun <[email protected]>2025-12-12 03:14:37 +0700
committerGitHub <[email protected]>2025-12-11 14:14:37 -0600
commit0efdc3a8a05fa4f78aa8dc7105aebf742aa8866f (patch)
treee4b070a970b6099db1077837240c1ac1fe8ef747 /github/action.yml
parentfc9dfd054ab6ad35afe0b867bbf789f0e62c31e6 (diff)
downloadopencode-0efdc3a8a05fa4f78aa8dc7105aebf742aa8866f.tar.gz
opencode-0efdc3a8a05fa4f78aa8dc7105aebf742aa8866f.zip
feat: add caching for opencode binary in GitHub Actions (#5384)
Diffstat (limited to 'github/action.yml')
-rw-r--r--github/action.yml19
1 files changed, 19 insertions, 0 deletions
diff --git a/github/action.yml b/github/action.yml
index d22d19990..f52f14d80 100644
--- a/github/action.yml
+++ b/github/action.yml
@@ -20,10 +20,29 @@ inputs:
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