Repository: nektos/act (language: go)

Issue:
Embedded artifact server inaccessible on clients with Zscaler Client Connector running
### Bug report info

```plain text
act version:            0.2.35
GOOS:                   darwin
GOARCH:                 amd64
NumCPU:                 16
Docker host:            DOCKER_HOST environment variable is unset/empty.
Sockets found:
	/var/run/docker.sock
Config files:
	/Users/robin/.actrc:
		-P ubuntu-latest=catthehacker/ubuntu:act-latest
		-P ubuntu-22.04=catthehacker/ubuntu:act-22.04
		-P ubuntu-20.04=catthehacker/ubuntu:act-20.04
		-P ubuntu-18.04=catthehacker/ubuntu:act-18.04
Build info:
	Go version:            go1.19.4
	Module path:           command-line-arguments
	Main version:
	Main path:
	Main checksum:
	Build settings:
		-compiler:            gc
		-ldflags:             -X main.version=0.2.35
		CGO_ENABLED:          1
		CGO_CFLAGS:
		CGO_CPPFLAGS:
		CGO_CXXFLAGS:
		CGO_LDFLAGS:
		GOARCH:               amd64
		GOOS:                 darwin
		GOAMD64:              v1
Docker Engine:
	Engine version:        20.10.21
	Engine runtime:        runc
	Cgroup version:        2
	Cgroup driver:         cgroupfs
	Storage driver:        overlay2
	Registry URI:          https://index.docker.io/v1/
	OS:                    Docker Desktop
	OS type:               linux
	OS version:
	OS arch:               x86_64
	OS kernel:             5.15.49-linuxkit
	OS CPU:                4
	OS memory:             7959 MB
	Security options:
		name=seccomp,profile=default
		name=cgroupns
```


### Command used with act

```sh
act workflow_dispatch -W .github/workflows/test.yml --artifact-server-path .
```


### Describe issue

On client devices with the Zscaler Client Connector installed, the outbound IP is always `100.64.0.1` (CGNAT). Unfortunately, on non-Linux devices, this address is unroutable from Docker Desktop's embedded VM or the containers running on it, thus making the embedded artifact server inaccessible.

### Link to GitHub repository

_No response_

### Workflow content

```yml
name: Test

on:
  workflow_dispatch: {}

jobs:
  release:
    runs-on: ubuntu-latest

    steps:
      - run: touch test-artifact
      - uses: actions/upload-artifact@v3
        with:
          name: artifacts
          path: test-artifact
```


### Relevant log output

```sh
DEBU[0000] Loading environment from /tmp/act-test/.env
DEBU[0000] Loading secrets from /tmp/act-test/.secrets
DEBU[0000] Loading workflow '/tmp/act-test/.github/workflows/test.yml'
DEBU[0000] Reading workflow '/tmp/act-test/.github/workflows/test.yml'
DEBU[0000] Using first passed in arguments event for filtering: workflow_dispatch
DEBU[0000] Preparing plan for a event: workflow_dispatch
DEBU[0000] Using first passed in arguments event: workflow_dispatch
DEBU[0000] Planning jobs for event: workflow_dispatch
DEBU[0000] Artifacts base path '.'
INFO[0000] Start server on http://100.64.0.1:34567
WARN[0000] unable to get git repo: unable to find git repo
WARN[0000] unable to get git ref: unable to find git repo
WARN[0000] unable to get git revision: unable to find git repo
[Test/release] [DEBUG] evaluating expression 'success()'
[Test/release] [DEBUG] expression 'success()' evaluated to 'true'
[Test/release] 🚀  Start image=catthehacker/ubuntu:act-latest
[Test/release]   🐳  docker pull image=catthehacker/ubuntu:act-latest platform= username= forcePull=false
[Test/release] [DEBUG]   🐳  docker pull catthehacker/ubuntu:act-latest
[Test/release] [DEBUG] Image exists? true
[Test/release]   🐳  docker create image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Test/release] [DEBUG] Common container.Config ==> &{Hostname: Domainname: User: AttachStdin:false AttachStdout:false AttachStderr:false ExposedPorts:map[] Tty:true OpenStdin:false StdinOnce:false Env:[RUNNER_TOOL_CACHE=/opt/hostedtoolcache RUNNER_OS=Linux RUNNER_ARCH=X64 RUNNER_TEMP=/tmp LANG=C.UTF-8] Cmd:[] Healthcheck:<nil> ArgsEscaped:false Image:catthehacker/ubuntu:act-latest Volumes:map[] WorkingDir:/tmp/act-test Entrypoint:[] NetworkDisabled:false MacAddress: OnBuild:[] Labels:map[] StopSignal: StopTimeout:<nil> Shell:[]}
[Test/release] [DEBUG] Common container.HostConfig ==> &{Binds:[/var/run/docker.sock:/var/run/docker.sock] ContainerIDFile: LogConfig:{Type: Config:map[]} NetworkMode:host PortBindings:map[] RestartPolicy:{Name: MaximumRetryCount:0} AutoRemove:false VolumeDriver: VolumesFrom:[] CapAdd:[] CapDrop:[] CgroupnsMode: DNS:[] DNSOptions:[] DNSSearch:[] ExtraHosts:[] GroupAdd:[] IpcMode: Cgroup: Links:[] OomScoreAdj:0 PidMode: Privileged:false PublishAllPorts:false ReadonlyRootfs:false SecurityOpt:[] StorageOpt:map[] Tmpfs:map[] UTSMode: UsernsMode: ShmSize:0 Sysctls:map[] Runtime: ConsoleSize:[0 0] Isolation: Resources:{CPUShares:0 Memory:0 NanoCPUs:0 CgroupParent: BlkioWeight:0 BlkioWeightDevice:[] BlkioDeviceReadBps:[] BlkioDeviceWriteBps:[] BlkioDeviceReadIOps:[] BlkioDeviceWriteIOps:[] CPUPeriod:0 CPUQuota:0 CPURealtimePeriod:0 CPURealtimeRuntime:0 CpusetCpus: CpusetMems: Devices:[] DeviceCgroupRules:[] DeviceRequests:[] KernelMemory:0 KernelMemoryTCP:0 MemoryReservation:0 MemorySwap:0 MemorySwappiness:<nil> OomKillDisable:<nil> PidsLimit:<nil> Ulimits:[] CPUCount:0 CPUPercent:0 IOMaximumIOps:0 IOMaximumBandwidth:0} Mounts:[{Type:volume Source:act-toolcache Target:/toolcache ReadOnly:false Consistency: BindOptions:<nil> VolumeOptions:<nil> TmpfsOptions:<nil>} {Type:volume Source:act-Test-release-env Target:/var/run/act ReadOnly:false Consistency: BindOptions:<nil> VolumeOptions:<nil> TmpfsOptions:<nil>} {Type:volume Source:act-Test-release Target:/tmp/act-test ReadOnly:false Consistency: BindOptions:<nil> VolumeOptions:<nil> TmpfsOptions:<nil>}] MaskedPaths:[] ReadonlyPaths:[] Init:<nil>}
[Test/release] [DEBUG] Created container name=act-Test-release id=7a348bfdaedc96e00a1296721658cb4e56b96515c3316d74e6a7a0330a94443a from image catthehacker/ubuntu:act-latest (platform: )
[Test/release] [DEBUG] ENV ==> [RUNNER_TOOL_CACHE=/opt/hostedtoolcache RUNNER_OS=Linux RUNNER_ARCH=X64 RUNNER_TEMP=/tmp LANG=C.UTF-8]
[Test/release]   🐳  docker run image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Test/release] [DEBUG] Starting container: 7a348bfdaedc96e00a1296721658cb4e56b96515c3316d74e6a7a0330a94443a
[Test/release] [DEBUG] Started container: 7a348bfdaedc96e00a1296721658cb4e56b96515c3316d74e6a7a0330a94443a
[Test/release] [DEBUG] Writing entry to tarball workflow/event.json len:2
[Test/release] [DEBUG] Writing entry to tarball workflow/envs.txt len:0
[Test/release] [DEBUG] Extracting content to '/var/run/act/'
[Test/release] unable to get git repo: unable to find git repo
[Test/release] unable to get git ref: unable to find git repo
[Test/release] unable to get git revision: unable to find git repo
[Test/release] unable to get git repo: unable to find git repo
[Test/release] unable to get git ref: unable to find git repo
[Test/release] unable to get git revision: unable to find git repo
[Test/release]   ☁  git clone 'https://github.com/actions/upload-artifact' # ref=v3
[Test/release] [DEBUG]   cloning https://github.com/actions/upload-artifact to /Users/user/.cache/act/actions-upload-artifact@v3
[Test/release] [DEBUG] Unable to pull refs/heads/v3: worktree contains unstaged changes
[Test/release] [DEBUG] Cloned https://github.com/actions/upload-artifact to /Users/user/.cache/act/actions-upload-artifact@v3
[Test/release] [DEBUG] Checked out v3
[Test/release] [DEBUG] Read action &{Upload a Build Artifact GitHub Upload a build artifact that can be used by subsequent workflow steps map[if-no-files-found:{The desired behavior if no files are found using the provided path.
Available Options:
  warn: Output a warning but do not fail the action
  error: Fail the action with an error message
  ignore: Do not output any warnings or errors, the action does not fail
 false warn} name:{Artifact name false artifact} path:{A file, directory or wildcard pattern that describes what to upload true } retention-days:{Duration after which artifact will expire in days. 0 means using default retention.
Minimum 1 day. Maximum 90 days unless changed from the repository settings page.
 false }] map[] {node16 map[] dist/index.js  always()  always()   [] []} { }} from 'Unknown'
[Test/release] unable to get git repo: unable to find git repo
[Test/release] unable to get git ref: unable to find git repo
[Test/release] unable to get git revision: unable to find git repo
[Test/release] unable to get git repo: unable to find git repo
[Test/release] unable to get git ref: unable to find git repo
[Test/release] unable to get git revision: unable to find git repo
[Test/release] unable to get git repo: unable to find git repo
[Test/release] unable to get git ref: unable to find git repo
[Test/release] unable to get git revision: unable to find git repo
[Test/release] [DEBUG] setupEnv => map[ACT:true ACTIONS_RUNTIME_TOKEN:token ACTIONS_RUNTIME_URL:http://100.64.0.1:34567/ AGENT_TOOLSDIRECTORY:/opt/hostedtoolcache CI:true DEBIAN_FRONTEND:noninteractive DEPLOYMENT_BASEPATH:/opt/runner GITHUB_ACTION:0 GITHUB_ACTIONS:true GITHUB_ACTION_PATH: GITHUB_ACTION_REF: GITHUB_ACTION_REPOSITORY: GITHUB_ACTOR:nektos/act GITHUB_API_URL:https://api.github.com GITHUB_BASE_REF: GITHUB_ENV:/var/run/act/workflow/envs.txt GITHUB_EVENT_NAME:workflow_dispatch GITHUB_EVENT_PATH:/var/run/act/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_HEAD_REF: GITHUB_JOB:release GITHUB_REF:refs/heads/master GITHUB_REF_NAME:master GITHUB_REF_TYPE:branch GITHUB_REPOSITORY: GITHUB_REPOSITORY_OWNER: GITHUB_RETENTION_DAYS:0 GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA: GITHUB_TOKEN: GITHUB_WORKFLOW:Test GITHUB_WORKSPACE:/tmp/act-test IMAGE_OS:ubuntu22 ImageOS:ubuntu20 LSB_OS_VERSION:2204 LSB_RELEASE:22.04 PATH:/opt/hostedtoolcache/node/16.19.0/x64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin RUNNER_PERFLOG:/dev/null RUNNER_TRACKING_ID: RUNNER_USER:root RUN_TOOL_CACHE:/opt/hostedtoolcache USER:root]
[Test/release] unable to get git repo: unable to find git repo
[Test/release] unable to get git ref: unable to find git repo
[Test/release] unable to get git revision: unable to find git repo
[Test/release] unable to get git repo: unable to find git repo
[Test/release] unable to get git ref: unable to find git repo
[Test/release] unable to get git revision: unable to find git repo
[Test/release] [DEBUG] evaluating expression ''
[Test/release] [DEBUG] expression '' evaluated to 'true'
[Test/release] ⭐ Run Main touch test-artifact
[Test/release] [DEBUG] Writing entry to tarball workflow/outputcmd.txt len:0
[Test/release] [DEBUG] Writing entry to tarball workflow/statecmd.txt len:0
[Test/release] [DEBUG] Writing entry to tarball workflow/pathcmd.txt len:0
[Test/release] [DEBUG] Extracting content to '/var/run/act'
[Test/release] unable to get git repo: unable to find git repo
[Test/release] unable to get git ref: unable to find git repo
[Test/release] unable to get git revision: unable to find git repo
[Test/release] unable to get git repo: unable to find git repo
[Test/release] unable to get git ref: unable to find git repo
[Test/release] unable to get git revision: unable to find git repo
[Test/release] unable to get git repo: unable to find git repo
[Test/release] unable to get git ref: unable to find git repo
[Test/release] unable to get git revision: unable to find git repo
[Test/release] unable to get git repo: unable to find git repo
[Test/release] unable to get git ref: unable to find git repo
[Test/release] unable to get git revision: unable to find git repo
[Test/release] [DEBUG] Wrote command

touch test-artifact

 to 'workflow/0'
[Test/release] [DEBUG] Writing entry to tarball workflow/0 len:21
[Test/release] [DEBUG] Extracting content to '/var/run/act'
[Test/release]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0] user= workdir=
[Test/release] [DEBUG] Exec command '[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0]'
[Test/release] [DEBUG] Working directory '/tmp/act-test'
[Test/release]   ✅  Success - Main touch test-artifact
[Test/release] unable to get git repo: unable to find git repo
[Test/release] unable to get git ref: unable to find git repo
[Test/release] unable to get git revision: unable to find git repo
[Test/release] unable to get git repo: unable to find git repo
[Test/release] unable to get git ref: unable to find git repo
[Test/release] unable to get git revision: unable to find git repo
[Test/release] unable to get git repo: unable to find git repo
[Test/release] unable to get git ref: unable to find git repo
[Test/release] unable to get git revision: unable to find git repo
[Test/release] [DEBUG] setupEnv => map[ACT:true ACTIONS_RUNTIME_TOKEN:token ACTIONS_RUNTIME_URL:http://100.64.0.1:34567/ AGENT_TOOLSDIRECTORY:/opt/hostedtoolcache CI:true DEBIAN_FRONTEND:noninteractive DEPLOYMENT_BASEPATH:/opt/runner GITHUB_ACTION:1 GITHUB_ACTIONS:true GITHUB_ACTION_PATH: GITHUB_ACTION_REF:v3 GITHUB_ACTION_REPOSITORY:actions/upload-artifact GITHUB_ACTOR:nektos/act GITHUB_API_URL:https://api.github.com GITHUB_BASE_REF: GITHUB_ENV:/var/run/act/workflow/envs.txt GITHUB_EVENT_NAME:workflow_dispatch GITHUB_EVENT_PATH:/var/run/act/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_HEAD_REF: GITHUB_JOB:release GITHUB_REF:refs/heads/master GITHUB_REF_NAME:master GITHUB_REF_TYPE:branch GITHUB_REPOSITORY: GITHUB_REPOSITORY_OWNER: GITHUB_RETENTION_DAYS:0 GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA: GITHUB_TOKEN: GITHUB_WORKFLOW:Test GITHUB_WORKSPACE:/tmp/act-test IMAGE_OS:ubuntu22 INPUT_NAME:artifacts INPUT_PATH:test-artifact ImageOS:ubuntu20 LSB_OS_VERSION:2204 LSB_RELEASE:22.04 PATH:/opt/hostedtoolcache/node/16.19.0/x64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin RUNNER_PERFLOG:/dev/null RUNNER_TRACKING_ID: RUNNER_USER:root RUN_TOOL_CACHE:/opt/hostedtoolcache USER:root]
[Test/release] unable to get git repo: unable to find git repo
[Test/release] unable to get git ref: unable to find git repo
[Test/release] unable to get git revision: unable to find git repo
[Test/release] unable to get git repo: unable to find git repo
[Test/release] unable to get git ref: unable to find git repo
[Test/release] unable to get git revision: unable to find git repo
[Test/release] [DEBUG] evaluating expression ''
[Test/release] [DEBUG] expression '' evaluated to 'true'
[Test/release] ⭐ Run Main actions/upload-artifact@v3
[Test/release] [DEBUG] Writing entry to tarball workflow/outputcmd.txt len:0
[Test/release] [DEBUG] Writing entry to tarball workflow/statecmd.txt len:0
[Test/release] [DEBUG] Writing entry to tarball workflow/pathcmd.txt len:0
[Test/release] [DEBUG] Extracting content to '/var/run/act'
[Test/release] unable to get git repo: unable to find git repo
[Test/release] unable to get git ref: unable to find git repo
[Test/release] unable to get git revision: unable to find git repo
[Test/release] [DEBUG] About to run action &{Upload a Build Artifact GitHub Upload a build artifact that can be used by subsequent workflow steps map[if-no-files-found:{The desired behavior if no files are found using the provided path.
Available Options:
  warn: Output a warning but do not fail the action
  error: Fail the action with an error message
  ignore: Do not output any warnings or errors, the action does not fail
 false warn} name:{Artifact name false artifact} path:{A file, directory or wildcard pattern that describes what to upload true } retention-days:{Duration after which artifact will expire in days. 0 means using default retention.
Minimum 1 day. Maximum 90 days unless changed from the repository settings page.
 false }] map[] {node16 map[] dist/index.js  always()  always()   [] []} { }}
[Test/release] unable to get git repo: unable to find git repo
[Test/release] unable to get git ref: unable to find git repo
[Test/release] unable to get git revision: unable to find git repo
[Test/release] unable to get git repo: unable to find git repo
[Test/release] unable to get git ref: unable to find git repo
[Test/release] unable to get git revision: unable to find git repo
[Test/release] [DEBUG] type=remote-action actionDir=/Users/user/.cache/act/actions-upload-artifact@v3 actionPath= workdir=/tmp/act-test actionCacheDir=/Users/user/.cache/act actionName=actions-upload-artifact@v3 containerActionDir=/var/run/act/actions/actions-upload-artifact@v3
[Test/release] [DEBUG] Removing /Users/user/.cache/act/actions-upload-artifact@v3/.gitignore before docker cp
[Test/release] [DEBUG] /var/run/act/actions/actions-upload-artifact@v3
[Test/release]   🐳  docker cp src=/Users/user/.cache/act/actions-upload-artifact@v3/ dst=/var/run/act/actions/actions-upload-artifact@v3/
[Test/release] [DEBUG] Writing tarball /var/folders/jy/ymjz39d57gdg3gv481q552dr0000gn/T/act4048109990 from /Users/user/.cache/act/actions-upload-artifact@v3/
[Test/release] [DEBUG] Stripping prefix:/Users/user/.cache/act/actions-upload-artifact@v3/ src:/Users/user/.cache/act/actions-upload-artifact@v3/
[Test/release] [DEBUG] Extracting content from '/var/folders/jy/ymjz39d57gdg3gv481q552dr0000gn/T/act4048109990' to '/var/run/act/actions/actions-upload-artifact@v3/'
[Test/release] [DEBUG] executing remote job container: [node /var/run/act/actions/actions-upload-artifact@v3/dist/index.js]
[Test/release]   🐳  docker exec cmd=[node /var/run/act/actions/actions-upload-artifact@v3/dist/index.js] user= workdir=
[Test/release] [DEBUG] Exec command '[node /var/run/act/actions/actions-upload-artifact@v3/dist/index.js]'
[Test/release] [DEBUG] Working directory '/tmp/act-test'
[Test/release]   💬  ::debug::followSymbolicLinks 'true'
[Test/release]   💬  ::debug::implicitDescendants 'true'
[Test/release]   💬  ::debug::omitBrokenSymbolicLinks 'true'
[Test/release]   💬  ::debug::followSymbolicLinks 'true'
[Test/release]   💬  ::debug::implicitDescendants 'true'
[Test/release]   💬  ::debug::matchDirectories 'true'
[Test/release]   💬  ::debug::omitBrokenSymbolicLinks 'true'
[Test/release]   💬  ::debug::Search path '/tmp/act-test/test-artifact'
[Test/release]   💬  ::debug::File:/tmp/act-test/test-artifact was found using the provided searchPath
| With the provided path, there will be 1 file uploaded
[Test/release]   💬  ::debug::Root artifact directory is /tmp/act-test
| Starting artifact upload
| For more detailed logs during the artifact upload process, enable step-debugging: https://docs.github.com/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging#enabling-step-debug-logging
| Artifact name is valid!
[Test/release]   💬  ::debug::Artifact Url: http://100.64.0.1:34567/_apis/pipelines/workflows/1/artifacts?api-version=6.0-preview
| Create Artifact Container - Attempt 1 of 5 failed with error: socket hang up
| Create Artifact Container - Attempt 2 of 5 failed with error: socket hang up
| Create Artifact Container - Attempt 3 of 5 failed with error: socket hang up
| Create Artifact Container - Attempt 4 of 5 failed with error: socket hang up
| Create Artifact Container - Attempt 5 of 5 failed with error: socket hang up
[Test/release]   ❗  ::error::Create Artifact Container failed: socket hang up
[Test/release]   ❌  Failure - Main actions/upload-artifact@v3
[Test/release] exitcode '1': failure
[Test/release] 🏁  Job failed
[Test/release] unable to get git repo: unable to find git repo
[Test/release] unable to get git ref: unable to find git repo
[Test/release] unable to get git revision: unable to find git repo
Error: Job 'release' failed
```


### Additional information

I've already developed a patch to address this issue: PR incoming.


Discussion / hints:

Fix patch:
diff --git a/README.md b/README.md
index f8577ee5966..6423a5481d7 100644
--- a/README.md
+++ b/README.md
@@ -169,8 +169,9 @@ It will save that information to `~/.actrc`, please refer to [Configuration](#co
   -a, --actor string                                user that triggered the event (default "nektos/act")
       --replace-ghe-action-with-github-com          If you are using GitHub Enterprise Server and allow specified actions from GitHub (github.com), you can set actions on this. (e.g. --replace-ghe-action-with-github-com=github/super-linter)
       --replace-ghe-action-token-with-github-com    If you are using replace-ghe-action-with-github-com and you want to use private actions on GitHub, you have to set personal access token
+      --artifact-server-addr string                 Defines the address to which the artifact server binds. (default "<default-outbound-IP>")
       --artifact-server-path string                 Defines the path where the artifact server stores uploads and retrieves downloads from. If not specified the artifact server will not start.
-      --artifact-server-port string                 Defines the port where the artifact server listens (will only bind to localhost). (default "34567")
+      --artifact-server-port string                 Defines the port where the artifact server listens. (default "34567")
   -b, --bind                                        bind working directory to container, rather than copy
       --container-architecture string               Architecture which should be used to run containers, e.g.: linux/amd64. If not specified, will use host default architecture. Requires Docker server API Version 1.41+. Ignored on earlier Docker server platforms.
       --container-cap-add stringArray               kernel capabilities to add to the workflow containers (e.g. --container-cap-add SYS_PTRACE)
diff --git a/cmd/input.go b/cmd/input.go
index 1caeccbb74e..37655a558a4 100644
--- a/cmd/input.go
+++ b/cmd/input.go
@@ -40,6 +40,7 @@ type Input struct {
 	containerCapDrop                   []string
 	autoRemove                         bool
 	artifactServerPath                 string
+	artifactServerAddr                 string
 	artifactServerPort                 string
 	jsonLogger                         bool
 	noSkipCheckout                     bool
diff --git a/cmd/root.go b/cmd/root.go
index 1d153abb318..78f3a72d2f5 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -82,7 +82,8 @@ func Execute(ctx context.Context, version string) {
 	rootCmd.PersistentFlags().StringVarP(&input.containerOptions, "container-options", "", "", "Custom docker container options for the job container without an options property in the job definition")
 	rootCmd.PersistentFlags().StringVarP(&input.githubInstance, "github-instance", "", "github.com", "GitHub instance to use. Don't use this if you are not using GitHub Enterprise Server.")
 	rootCmd.PersistentFlags().StringVarP(&input.artifactServerPath, "artifact-server-path", "", "", "Defines the path where the artifact server stores uploads and retrieves downloads from. If not specified the artifact server will not start.")
-	rootCmd.PersistentFlags().StringVarP(&input.artifactServerPort, "artifact-server-port", "", "34567", "Defines the port where the artifact server listens (will only bind to localhost).")
+	rootCmd.PersistentFlags().StringVarP(&input.artifactServerAddr, "artifact-server-addr", "", common.GetOutboundIP().String(), "Defines the address to which the artifact server binds.")
+	rootCmd.PersistentFlags().StringVarP(&input.artifactServerPort, "artifact-server-port", "", "34567", "Defines the port where the artifact server listens.")
 	rootCmd.PersistentFlags().BoolVarP(&input.noSkipCheckout, "no-skip-checkout", "", false, "Do not skip actions/checkout")
 	rootCmd.SetArgs(args())
 
@@ -482,6 +483,7 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str
 			ContainerCapDrop:                   input.containerCapDrop,
 			AutoRemove:                         input.autoRemove,
 			ArtifactServerPath:                 input.artifactServerPath,
+			ArtifactServerAddr:                 input.artifactServerAddr,
 			ArtifactServerPort:                 input.artifactServerPort,
 			NoSkipCheckout:                     input.noSkipCheckout,
 			RemoteName:                         input.remoteName,
@@ -493,7 +495,7 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str
 			return err
 		}
 
-		cancel := artifacts.Serve(ctx, input.artifactServerPath, input.artifactServerPort)
+		cancel := artifacts.Serve(ctx, input.artifactServerPath, input.artifactServerAddr, input.artifactServerPort)
 
 		ctx = common.WithDryrun(ctx, input.dryrun)
 		if watch, err := cmd.Flags().GetBool("watch"); err != nil {
diff --git a/pkg/artifacts/server.go b/pkg/artifacts/server.go
index 06a77061698..9b11457338c 100644
--- a/pkg/artifacts/server.go
+++ b/pkg/artifacts/server.go
@@ -262,7 +262,7 @@ func downloads(router *httprouter.Router, fsys fs.FS) {
 	})
 }
 
-func Serve(ctx context.Context, artifactPath string, port string) context.CancelFunc {
+func Serve(ctx context.Context, artifactPath string, addr string, port string) context.CancelFunc {
 	serverContext, cancel := context.WithCancel(ctx)
 	logger := common.Logger(serverContext)
 
@@ -276,17 +276,16 @@ func Serve(ctx context.Context, artifactPath string, port string) context.Cancel
 	fs := os.DirFS(artifactPath)
 	uploads(router, MkdirFsImpl{artifactPath, fs})
 	downloads(router, fs)
-	ip := common.GetOutboundIP().String()
 
 	server := &http.Server{
-		Addr:              fmt.Sprintf("%s:%s", ip, port),
+		Addr:              fmt.Sprintf("%s:%s", addr, port),
 		ReadHeaderTimeout: 2 * time.Second,
 		Handler:           router,
 	}
 
 	// run server
 	go func() {
-		logger.Infof("Start server on http://%s:%s", ip, port)
+		logger.Infof("Start server on http://%s:%s", addr, port)
 		if err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed {
 			logger.Fatal(err)
 		}
diff --git a/pkg/runner/run_context.go b/pkg/runner/run_context.go
index c9c8ea1d439..fa2da05d1ce 100644
--- a/pkg/runner/run_context.go
+++ b/pkg/runner/run_context.go
@@ -751,7 +751,7 @@ func (rc *RunContext) withGithubEnv(ctx context.Context, github *model.GithubCon
 func setActionRuntimeVars(rc *RunContext, env map[string]string) {
 	actionsRuntimeURL := os.Getenv("ACTIONS_RUNTIME_URL")
 	if actionsRuntimeURL == "" {
-		actionsRuntimeURL = fmt.Sprintf("http://%s:%s/", common.GetOutboundIP().String(), rc.Config.ArtifactServerPort)
+		actionsRuntimeURL = fmt.Sprintf("http://%s:%s/", rc.Config.ArtifactServerAddr, rc.Config.ArtifactServerPort)
 	}
 	env["ACTIONS_RUNTIME_URL"] = actionsRuntimeURL
 
diff --git a/pkg/runner/runner.go b/pkg/runner/runner.go
index 9eb225fb66c..7e3f9b1b41b 100644
--- a/pkg/runner/runner.go
+++ b/pkg/runner/runner.go
@@ -48,6 +48,7 @@ type Config struct {
 	ContainerCapDrop                   []string          // list of kernel capabilities to remove from the containers
 	AutoRemove                         bool              // controls if the container is automatically removed upon workflow completion
 	ArtifactServerPath                 string            // the path where the artifact server stores uploads
+	ArtifactServerAddr                 string            // the address the artifact server binds to
 	ArtifactServerPort                 string            // the port the artifact server binds to
 	NoSkipCheckout                     bool              // do not skip actions/checkout
 	RemoteName                         string            // remote name in local git repo config


Test patch:
diff --git a/pkg/artifacts/server_test.go b/pkg/artifacts/server_test.go
index f1c09a30671..6f865dc2b7f 100644
--- a/pkg/artifacts/server_test.go
+++ b/pkg/artifacts/server_test.go
@@ -240,7 +240,8 @@ type TestJobFileInfo struct {
 	containerArchitecture string
 }
 
-var aritfactsPath = path.Join(os.TempDir(), "test-artifacts")
+var artifactsPath = path.Join(os.TempDir(), "test-artifacts")
+var artifactsAddr = "127.0.0.1"
 var artifactsPort = "12345"
 
 func TestArtifactFlow(t *testing.T) {
@@ -250,7 +251,7 @@ func TestArtifactFlow(t *testing.T) {
 
 	ctx := context.Background()
 
-	cancel := Serve(ctx, aritfactsPath, artifactsPort)
+	cancel := Serve(ctx, artifactsPath, artifactsAddr, artifactsPort)
 	defer cancel()
 
 	platforms := map[string]string{
@@ -271,7 +272,7 @@ func runTestJobFile(ctx context.Context, t *testing.T, tjfi TestJobFileInfo) {
 	t.Run(tjfi.workflowPath, func(t *testing.T) {
 		fmt.Printf("::group::%s\n", tjfi.workflowPath)
 
-		if err := os.RemoveAll(aritfactsPath); err != nil {
+		if err := os.RemoveAll(artifactsPath); err != nil {
 			panic(err)
 		}
 
@@ -286,7 +287,8 @@ func runTestJobFile(ctx context.Context, t *testing.T, tjfi TestJobFileInfo) {
 			ReuseContainers:       false,
 			ContainerArchitecture: tjfi.containerArchitecture,
 			GitHubInstance:        "github.com",
-			ArtifactServerPath:    aritfactsPath,
+			ArtifactServerPath:    artifactsPath,
+			ArtifactServerAddr:    artifactsAddr,
 			ArtifactServerPort:    artifactsPort,
 		}