Fix action.yml for remote consumers: env vars + source-build CWD [murmur:tool/should-build-action-ref-bugs] - #7
Merged
maerlyn5 merged 1 commit intoMay 21, 2026
Conversation
Two bugs made the composite action fail for real consumers (any repo
using `uses: prassoai/should-build@v0`):
1. `${{ github.action_ref }}` and `${{ github.action_repository }}`
evaluate to empty strings inside a composite action's `run:` block.
The action's own ref/repository are exposed as runtime env vars
`$GITHUB_ACTION_REF` and `$GITHUB_ACTION_REPOSITORY` — use those.
2. The source-build fallback ran `go build` in the consumer repo's
working directory, where Go refused with "outside main module"
because the action's `cmd/should-build` is not part of the
consumer's module. Use `go build -C` to build from the action's
own directory.
Add a CI job (test-consumer-simulation) that reproduces the consumer
layout: action source in a separate checkout, working directory in a
different repo. This catches both bugs structurally.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
maerlyn5
deleted the
murmur/w/tool/github_oauth/maerlyn5/should-build-action-ref-bugs
branch
May 21, 2026 16:06
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.
Summary
tag/repoin download step: Replace${{ github.action_ref }}/${{ github.action_repository }}with runtime env vars$GITHUB_ACTION_REF/$GITHUB_ACTION_REPOSITORY. The expression syntax evaluates to empty strings inside composite actionrun:blocks — the runtime env vars are the correct way to access the action's own ref and repository.go build -C "${{ github.action_path }}"so the Go toolchain builds from the action's directory, not the consumer repo's working directory (which has a differentgo.mod).test-consumer-simulationjob reproduces the exact layout GitHub Actions creates for remote consumers (action checkout in a separate path, CWD in consumer repo), catching both bugs structurally.Context
Real failure from murmuration:
The existing
uses: ./test worked because (a)tag=""correctly falls through to source build, and (b) the working directory IS the action's checkout when using a local action reference.Test plan
test-actionandtest-action-filteredjobs pass (source-build viauses: ./still works)test-consumer-simulationjob passes (source-build from consumer CWD works)action.ymluses env vars, not expression syntaxAfter merge: tag v0.3 and force-push v0 so
@v0consumers pick up the fix.Created via Murmur
🤖 Generated with Claude Code