Skip to content

Fix action.yml for remote consumers: env vars + source-build CWD [murmur:tool/should-build-action-ref-bugs] - #7

Merged
maerlyn5 merged 1 commit into
mainfrom
murmur/w/tool/github_oauth/maerlyn5/should-build-action-ref-bugs
May 21, 2026
Merged

Fix action.yml for remote consumers: env vars + source-build CWD [murmur:tool/should-build-action-ref-bugs]#7
maerlyn5 merged 1 commit into
mainfrom
murmur/w/tool/github_oauth/maerlyn5/should-build-action-ref-bugs

Conversation

@maerlyn5

Copy link
Copy Markdown
Contributor

Summary

  • Fix empty tag/repo in 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 action run: blocks — the runtime env vars are the correct way to access the action's own ref and repository.
  • Fix source-build CWD: Use 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 different go.mod).
  • Add consumer simulation CI test: New test-consumer-simulation job 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:

tag=""
repo=""
... falls through to source-build ...
directory ../../_actions/prassoai/should-build/v0/cmd/should-build outside main module or its selected dependencies

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

  • Existing test-action and test-action-filtered jobs pass (source-build via uses: ./ still works)
  • New test-consumer-simulation job passes (source-build from consumer CWD works)
  • Structural grep confirms action.yml uses env vars, not expression syntax
  • End-to-end consumer scenario: build binary, run it against a different repo, verify correct output

After merge: tag v0.3 and force-push v0 so @v0 consumers pick up the fix.

Created via Murmur

🤖 Generated with Claude Code

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
maerlyn5 merged commit 736f664 into main May 21, 2026
5 checks passed
@maerlyn5
maerlyn5 deleted the murmur/w/tool/github_oauth/maerlyn5/should-build-action-ref-bugs branch May 21, 2026 16:06
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.

1 participant