Handle two-line anchor version output breaking CI#98
Merged
Conversation
The Anchor matrix aborts at toolchain setup with:
##[error]Unable to process file command 'output' successfully.
##[error]Invalid format '1.1.2'
heyAyushh/setup-anchor@v4.999 detects an existing install with
`anchor --version | awk '{print $2}'` and writes the result to
$GITHUB_OUTPUT. `anchor --version` now prints more than one line, so the
value is multi-line and the write fails, killing every matrix group before any
project is built. It only surfaces when the Anchor matrix actually runs (a
change touches an Anchor project), which is why main looks green.
Replace the action in anchor.yml with the same install steps (Solana via the
Anza installer, Anchor via avm) plus toolchain caching, and read the version
from the first line only so a multi-line value can't break the run. The other
workflows using setup-anchor (native, quasar, pinocchio, solana-asm) share the
latent bug and can be migrated the same way once this is confirmed green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Anchor workflow aborts at toolchain setup, before any project is built:
heyAyushh/setup-anchor@v4.999detects an existing install with:anchor --versionnow emits more than one line, soawk '{print $2}'returns a multi-line value, and writing a multi-line value to$GITHUB_OUTPUTfails withInvalid format. That kills every matrix group at setup.It only surfaces when the Anchor matrix actually runs (a change touches an Anchor project).
mainlooks green because its last run changed no Anchor projects, so the matrix was skipped andsetup-anchornever ran — the bug is latent, not absent.Fix
Replace
setup-anchorinanchor.ymlwith the same install steps it performs — Solana via the Anza installer, Anchor viaavm— plus toolchain caching, and read the Anchor version from the first line only (head -n1) so a multi-lineanchor --versioncan never break parsing again.The action's own master branch still has the buggy
awk '{print $2}', so pinning to another tag would not help.Scope / follow-up
anchor.yml. Editing the workflow file triggers a full-matrix run, so this PR's own CI exercises the new setup across every Anchor project.native.yml,quasar.yml,pinocchio.yml, andsolana-asm.ymluse the same action and share the latent bug; they can be migrated the same way once this is confirmed green.Validation
GitHub Actions changes can't be run locally — this relies on the PR's own CI to confirm the full Anchor matrix installs the toolchain and passes.
🤖 Generated with Claude Code
Generated by Claude Code