Skip to content

Handle two-line anchor version output breaking CI#98

Merged
mikemaccana merged 1 commit into
mainfrom
claude/ci-fix-anchor-version
Jul 7, 2026
Merged

Handle two-line anchor version output breaking CI#98
mikemaccana merged 1 commit into
mainfrom
claude/ci-fix-anchor-version

Conversation

@mikemaccana

Copy link
Copy Markdown
Collaborator

Problem

The Anchor workflow aborts at toolchain setup, before any project is built:

Found existing Anchor installation: 3.1.10
1.1.2
##[error]Unable to process file command 'output' successfully.
##[error]Invalid format '1.1.2'

heyAyushh/setup-anchor@v4.999 detects an existing install with:

installed_version=$(anchor --version | awk '{print $2}')
echo "installed_version=$installed_version" >> $GITHUB_OUTPUT

anchor --version now emits more than one line, so awk '{print $2}' returns a multi-line value, and writing a multi-line value to $GITHUB_OUTPUT fails with Invalid format. That kills every matrix group at setup.

It only surfaces when the Anchor matrix actually runs (a change touches an Anchor project). main looks green because its last run changed no Anchor projects, so the matrix was skipped and setup-anchor never ran — the bug is latent, not absent.

Fix

Replace setup-anchor in anchor.yml with the same install steps it performs — Solana via the Anza installer, Anchor via avm — plus toolchain caching, and read the Anchor version from the first line only (head -n1) so a multi-line anchor --version can 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

  • This changes only 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, and solana-asm.yml use 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

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.
@mikemaccana mikemaccana merged commit ba29254 into main Jul 7, 2026
39 checks passed
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.

2 participants