A GitHub Action for OpenCode with pinned actions/cache and OpenCode versions.
This action is a fork of the official action. It updates actions/cache, improves the OpenCode installation logic, pins the OpenCode version, and verifies the SHA256 checksum on every run, whether the cache is hit or missed.
Important
This action uses ${{ github.token }} in the Resolve opencode release metadata step only so gh can fetch OpenCode release metadata. By default, the token is not exposed to OpenCode itself. If you want OpenCode to access the token, for example to create issues, pass it through the step environment as GH_TOKEN: ${{ github.token }}.
Both actions/cache and OpenCode are updated automatically by Renovate with minimumReleaseAge set to 1. Use this action with a pinned Git SHA, and make sure you have a dependency management tool like Renovate or Dependabot enabled so you do not miss updates.
Use it the same way as the official action.
First, get the latest Git SHA for this repo:
curl -fsSL "https://api.github.com/repos/xlionjuan/opencode-github-actions/branches/main" | jq -r '.commit.sha'Then replace anomalyco/opencode/github@latest with xlionjuan/opencode-github-actions@{GIT SHA}, using the value from the previous step:
Warning
You should NEVER use latest ! Check Upgrade best practices.
The # main is necessary to let managers knows which branch it should tracking.
- name: Run opencode
uses: xlionjuan/opencode-github-actions@{GIT SHA} # mainThese are the reasons I created this forked action.
[FEATURE]: Add version input to the GitHub action anomalyco/opencode#31387
[FEATURE]: Add SHA256 checksum verification to the install script anomalyco/opencode#31390
For development use only.
act workflow_dispatch \
-W .github/workflows/test.yml \
-j opencode \
--secret-file .env