mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-03-22 06:45:03 +01:00
fix: fallback of localRepository cache being nil (#29)
Doing `act --local-repository test/self-ref@main=/folder-path/self-ref` caused a null pointer exception while fetching a non mapped entry, due to missing remote fallback. Reviewed-on: https://gitea.com/actions-oss/act-cli/pulls/29 Co-authored-by: Christopher Homberger <christopher.homberger@web.de> Co-committed-by: Christopher Homberger <christopher.homberger@web.de>
This commit is contained in:
committed by
ChristopherHX
parent
6c827eba95
commit
8505f73fe4
@@ -653,11 +653,13 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str
|
|||||||
ContainerNetworkMode: docker_container.NetworkMode(input.networkName),
|
ContainerNetworkMode: docker_container.NetworkMode(input.networkName),
|
||||||
Parallel: input.parallel,
|
Parallel: input.parallel,
|
||||||
}
|
}
|
||||||
|
actionCache := runner.GoGitActionCache{
|
||||||
|
Path: config.ActionCacheDir,
|
||||||
|
}
|
||||||
|
config.ActionCache = &actionCache
|
||||||
if input.actionOfflineMode {
|
if input.actionOfflineMode {
|
||||||
config.ActionCache = &runner.GoGitActionCacheOfflineMode{
|
config.ActionCache = &runner.GoGitActionCacheOfflineMode{
|
||||||
Parent: runner.GoGitActionCache{
|
Parent: actionCache,
|
||||||
Path: config.ActionCacheDir,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(input.localRepository) > 0 {
|
if len(input.localRepository) > 0 {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package cmd
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"path"
|
"path"
|
||||||
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
@@ -93,3 +94,16 @@ func TestWorkflowCall(t *testing.T) {
|
|||||||
})(rootCmd, []string{"workflow_call"})
|
})(rootCmd, []string{"workflow_call"})
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestLocalRepositories(t *testing.T) {
|
||||||
|
wd, _ := filepath.Abs("../pkg/runner/testdata/")
|
||||||
|
rootCmd := createRootCommand(context.Background(), &Input{}, "")
|
||||||
|
err := newRunCommand(context.Background(), &Input{
|
||||||
|
githubInstance: "github.com",
|
||||||
|
platforms: []string{"ubuntu-latest=node:16-buster-slim"},
|
||||||
|
workdir: wd,
|
||||||
|
workflowsPath: "./remote-action-composite-action-ref-partial-override/push.yml",
|
||||||
|
localRepository: []string{"needs/override@main=" + wd + "/actions-environment-and-context-tests"},
|
||||||
|
})(rootCmd, []string{"push"})
|
||||||
|
assert.NoError(t, err)
|
||||||
|
}
|
||||||
|
|||||||
9
pkg/runner/testdata/remote-action-composite-action-ref-partial-override/push.yml
vendored
Normal file
9
pkg/runner/testdata/remote-action-composite-action-ref-partial-override/push.yml
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
name: remote-action-composite-action-ref
|
||||||
|
on: push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: nektos/act-test-actions/composite-assert-action-ref-action@main
|
||||||
|
- uses: needs/override/js@main
|
||||||
Reference in New Issue
Block a user