mirror of
https://gitea.com/gitea/runner.git
synced 2026-09-01 17:07:46 +00:00
fix: preserve symlinked Node action entrypoints (#1202)
Node resolves an ESM main to its realpath but leaves `process.argv[1]` as passed. `/var/run/act` reaches the action through the `/var/run` -> `/run` symlink most images ship, so the two disagree and actions comparing them skip their own `run()`. Passing `--preserve-symlinks-main` makes them match. Trade-off: an action whose `runs.main` is a symlink now resolves dependencies from the link's directory rather than the target's. Fixes https://gitea.com/gitea/runner/issues/1201 Co-authored-by: silverwind <me@silverwind.io> Reviewed-on: https://gitea.com/gitea/runner/pulls/1202 Reviewed-by: silverwind <2021+silverwind@noreply.gitea.com> Co-authored-by: bircni <bircni@noreply.gitea.com>
This commit is contained in:
@@ -470,10 +470,10 @@ func TestStepActionRemotePost(t *testing.T) {
|
||||
if tt.mocks.exec {
|
||||
// Use mock.MatchedBy to match the exec command with hash-based path
|
||||
execMatcher := mock.MatchedBy(func(args []string) bool {
|
||||
if len(args) != 2 {
|
||||
if len(args) != 3 {
|
||||
return false
|
||||
}
|
||||
return args[0] == "node" && strings.Contains(args[1], "post.js")
|
||||
return args[0] == "node" && args[1] == "--preserve-symlinks-main" && strings.Contains(args[2], "post.js")
|
||||
})
|
||||
|
||||
cm.On("Exec", execMatcher, sar.env, "", "").Return(func(ctx context.Context) error { return tt.err })
|
||||
|
||||
Reference in New Issue
Block a user