Skip to content

fix(github): run bundled installer at pinned ref and allow pinning the CLI version - #39147

Open
laurigates wants to merge 1 commit into
anomalyco:devfrom
laurigates:fix/pin-installer-and-cli-version
Open

fix(github): run bundled installer at pinned ref and allow pinning the CLI version#39147
laurigates wants to merge 1 commit into
anomalyco:devfrom
laurigates:fix/pin-installer-and-cli-version

Conversation

@laurigates

@laurigates laurigates commented Jul 27, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #39163

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Pinning the action to a commit SHA didn't pin anything that runs: the installer was fetched from opencode.ai at run time, and the CLI was always the latest release. The version resolved from the releases API only fed the cache key — it was never passed to the installer.

Two changes:

  1. curl -fsSL https://opencode.ai/install | bashbash "$GITHUB_ACTION_PATH/../install". The whole repo is checked out when a subdirectory action runs, so ./install is already there at the pinned ref.
  2. New optional version input, passed to the installer as VERSION. The installer already reads it.

Two details that aren't obvious from the diff:

  • It has to be bash, not sh./install is #!/usr/bin/env bash and uses [[ ]].
  • The step now emits resolved (given to the installer) separately from version (cache key). They differ when the API lookup fails: version keeps the existing latest placeholder, but sending VERSION=latest to the installer would make it look for a release tagged vlatest, so resolved is left empty and the installer picks latest itself, as before.

./install is sha256-identical to what opencode.ai serves today, so this changes where the script comes from, not what it does.

How did you verify your code works?

Ran both paths on an ubuntu-latest runner against this branch.

With version: "1.18.6" (latest was 1.18.7):

key: opencode-Linux-X64-1.18.6
Installing opencode version: 1.18.6
$ opencode --version
1.18.6

Without the input — same as before this PR:

key: opencode-Linux-X64-v1.18.7
Installing opencode version: 1.18.7
$ opencode --version
1.18.7

I also checked $GITHUB_ACTION_PATH/../install resolves on a runner before writing this: for a subdirectory action action_path is _actions/<owner>/<repo>/<ref>/github, so ../install lands on the repo-root script.

To reproduce: point a workflow at this branch with and without version, and check opencode --version.

Screenshots / recordings

n/a — not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Jul 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

laurigates added a commit to laurigates/.github that referenced this pull request Jul 27, 2026
## Summary

Follow-up to #42. The `reusable-opencode.yml` note records that a SHA
pin covers only the composite wrapper, because `action.yml` `curl`s the
latest opencode CLI at run time regardless of the pin.

That gap now has a proposed upstream fix —
[anomalyco/opencode#39147](anomalyco/opencode#39147),
which runs the installer bundled at the pinned ref and adds a `version`
input passed through to it. This points at it and records the action to
take here if it lands: bump the pinned SHA and set `version` in the
reusable workflow.

Would have ridden in #42, but that merged first.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GitHub action: pinning the action to a SHA doesn't pin the installer or the CLI version

1 participant