fix: resolve local actions inside remote composites#83
Conversation
|
The flow in my test is: The action tests this workflow in the local repo: |
There was a problem hiding this comment.
Pull request overview
Fixes remote composite expansion so local uses: ./... references are resolved relative to the composite action’s directory (instead of the remote repo root), matching GitHub composite-action behavior.
Changes:
- Resolve nested
./...paths in remote composite actions by joining against the parent composite’sactionPath. - Update Jest coverage to reflect composite-directory-relative resolution for remote composites.
Show a summary per file
| File | Description |
|---|---|
src/index.js |
Adjusts remote composite nested local-path resolution to be relative to the composite action directory. |
__tests__/index.test.js |
Updates the remote composite path-resolution test and expected fetched path accordingly. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 1
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Great PR! Thanks for the fix ⚒️ @Wuodan |
📦 Draft Release CreatedA draft release v2.5.4 has been created for this PR. Next Steps
|
I think the merge of last PR #81 left a small gap: local paths in remote actions.
This PR fixes it.
I try to explain the scenario below.
Remote Composite Local Path Resolution
The real-world scenario is this:
Example:
The scanner loads that file because
owner/repo/path@refmeans "fetchpath/action.ymlfrom that repository at that ref".Inside that composite action, one of its steps uses another local action via a relative path:
So the chain is:
some-owner/some-repo/composite-actions/parent@v1composite-actions/parent/action.ymluses: ./childcomposite-actions/parent/child/action.ymlThe key point is how GitHub treats
./childhere.At first glance, it is easy to ask whether
./childshould be relative to the repository root. For composite actions, GitHub's docs point the other way: localuses: ./...references are relative to the composite action's own directory.Relevant GitHub docs:
Composite action tutorial:
https://docs.github.com/en/actions/tutorials/creating-a-composite-action
This says to use "the relative path to the folder where the composite action's
action.ymlfile is located" in theuseskey.Metadata syntax reference:
https://docs.github.com/actions/sharing-automations/creating-actions/metadata-syntax-for-github-actions
This documents local action references inside composite steps, for example
uses: ./.github/actions/my-action.Applied to this scenario,
./childinside:should resolve relative to
composite-actions/parent/, so the correct target is:not:
That is the bug fixed here: upstream currently resolves
./childas if it were repository-root-relative, but for composite actions it needs to be resolved relative to the directory of the composite action currently being expanded.