Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run local actions outside the workspace #2107

Open
jenseng opened this issue Nov 29, 2023 · 5 comments · May be fixed by #2108
Open

Can't run local actions outside the workspace #2107

jenseng opened this issue Nov 29, 2023 · 5 comments · May be fixed by #2108
Labels
kind/bug Something isn't working

Comments

@jenseng
Copy link
Contributor

jenseng commented Nov 29, 2023

Bug report info

act version:            0.2.54
GOOS:                   darwin
GOARCH:                 arm64
NumCPU:                 12
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
	/var/run/docker.sock
	$HOME/.docker/run/docker.sock
Config files:
	/Users/jonj/.actrc:
		-P ubuntu-latest=node:16-buster-slim
		-P ubuntu-22.04=node:16-bullseye-slim
		-P ubuntu-20.04=node:16-buster-slim
		-P ubuntu-18.04=node:16-buster-slim
Build info:
	Go version:            go1.21.4
	Module path:           command-line-arguments
	Main version:
	Main path:
	Main checksum:
	Build settings:
		-buildmode:           exe
		-compiler:            gc
		-ldflags:             -X main.version=0.2.54
		DefaultGODEBUG:       panicnil=1
		CGO_ENABLED:          1
		CGO_CFLAGS:
		CGO_CPPFLAGS:
		CGO_CXXFLAGS:
		CGO_LDFLAGS:
		GOARCH:               arm64
		GOOS:                 darwin
Docker Engine:
	Engine version:        24.0.6
	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:               aarch64
	OS kernel:             6.4.16-linuxkit
	OS CPU:                12
	OS memory:             7844 MB
	Security options:
		name=seccomp,profile=unconfined
		name=cgroupns

Command used with act

act -W .github/workflows/sample.yml -v

Describe issue

If you attempt to use a local action outside the workspace, act is unable to resolve it and emits a file does not exist error. It looks like getContainerActionPaths assumes local actions live under the $GITHUB_WORKSPACE, so it ends up looking for them in a nonexistent path like $GITHUB_WORKSPACE/previously/absolute/path/to/action.

These workflows are able to run successfully on GitHub.

Rationale

This is a bit of an edge case, but I've run into this in an monorepo where some actions call other actions locally. The tl;dr: is that one composite action determines its own location via github.action_path, and then uses that to dynamically call other actions from the same checkout (via dynamic-uses). This way I can ensure that I use the exact same version for all actions, and that it works whether I'm using the actions from the current repo or from another one.

Currently this all works fine when running on GitHub. When running under act, it works when I use the top-level action via local checkout, but it fails when I use it via ref, since it resolves the other actions to paths outside the workspace. To better illustrate what's happening, actions live under the actions subdirectory, and my top-level actions do something like this:

  steps:
    - name: Determine actions path
      env:
        github_action_path: ${{ github.action_path }}
      run: echo "my_actions_path=./$(realpath --relative-to="$GITHUB_WORKSPACE" "$github_action_path"/../..)" >> "$GITHUB_ENV"
      # if the current action was invoked from a local checkout, this will be something like:
      #   "./."
      # if the current action was invoked by ref, this will be something like:
      #   "./../../_actions/Org/repo/sha" (GitHub), or
      #   "./../../../../run/act/actions/Org-repo-actions-my-action@sha" (act)
      shell: bash
    - name: Call some-action
      uses: jenseng/dynamic-uses@v1 
      with:
        uses: ${{ env.my_actions_path }}/actions/some-action
    - name: Call another-action
      uses: jenseng/dynamic-uses@v1 
      with:
        uses: ${{ env.my_actions_path }}/actions/another-action

While another approach might be to use the github.action_ref, I'd like to be able to use/test actions locally without needing the ref to exist (e.g. when testing changes locally via act).

Link to GitHub repository

https://github.com/jenseng/dynamic-uses/actions/runs/7036492016/job/19149221462

Workflow content

name: test
on: push
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - run: mkdir ../action-outside-workspace
      - run: |
          cat <<-ACTIONEOF > ../action-outside-workspace/action.yml
          name: test
          runs:
            using: composite
            steps:
              - run: echo hello
                shell: bash
          ACTIONEOF
      - uses: ./../action-outside-workspace

Relevant log output

WARN  ⚠ You are using Apple M-series chip and you have not specified container architecture, you might encounter issues while running act. If so, try running it with '--container-architecture linux/amd64'. ⚠
DEBU[0000] Loading environment from /Users/jonj/projects/dynamic-uses/.env
DEBU[0000] Loading action inputs from /Users/jonj/projects/dynamic-uses/.input
DEBU[0000] Loading secrets from /Users/jonj/projects/dynamic-uses/.secrets
DEBU[0000] Loading vars from /Users/jonj/projects/dynamic-uses/.vars
DEBU[0000] Evaluated matrix inclusions: map[]
DEBU[0000] Loading workflow '/Users/jonj/projects/dynamic-uses/.github/workflows/sample.yml'
DEBU[0000] Reading workflow '/Users/jonj/projects/dynamic-uses/.github/workflows/sample.yml'
DEBU[0000] Conditional GET for notices etag=dbaa35d1-9292-40e1-92f5-fb5641929cf4
DEBU[0000] Preparing plan with all jobs
DEBU[0000] Using the only detected workflow event: push
DEBU[0000] Planning jobs for event: push
DEBU[0000] gc: 2023-11-29 10:24:06.667635 -0700 MST m=+0.039522043  module=artifactcache
DEBU[0000] Plan Stages: [0x14000118348]
DEBU[0000] Stages Runs: [test]
DEBU[0000] Job.Name: test
DEBU[0000] Job.RawNeeds: {0 0    <nil> []    0 0}
DEBU[0000] Job.RawRunsOn: {8 0 !!str ubuntu-latest  <nil> []    5 14}
DEBU[0000] Job.Env: {0 0    <nil> []    0 0}
DEBU[0000] Job.If: {0 0  success()  <nil> []    0 0}
DEBU[0000] Job.Steps: mkdir ../action-outside-workspace
DEBU[0000] Job.Steps: cat <<-ACTIONEOF > ../action-outside-workspace/action.yml
name: test
runs:
  using: composite
  steps:
    - run: echo hello
      shell: bash
ACTIONEOF
DEBU[0000] Job.Steps: cat ../action-outside-workspace/action.yml
DEBU[0000] Job.Steps: ./../action-outside-workspace
DEBU[0000] Job.TimeoutMinutes:
DEBU[0000] Job.Services: map[]
DEBU[0000] Job.Strategy: <nil>
DEBU[0000] Job.RawContainer: {0 0    <nil> []    0 0}
DEBU[0000] Job.Defaults.Run.Shell:
DEBU[0000] Job.Defaults.Run.WorkingDirectory:
DEBU[0000] Job.Outputs: map[]
DEBU[0000] Job.Uses:
DEBU[0000] Job.With: map[]
DEBU[0000] Job.Result:
DEBU[0000] Empty Strategy, matrixes=[map[]]
DEBU[0000] Job Matrices: [map[]]
DEBU[0000] Runner Matrices: map[]
DEBU[0000] Final matrix after applying user inclusions '[map[]]'
DEBU[0000] Loading revision from git directory
DEBU[0000] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
DEBU[0000] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
DEBU[0000] using github ref: refs/heads/debug-act-bug7
DEBU[0000] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
DEBU[0000] Detected CPUs: 12
[test/test] [DEBUG] evaluating expression 'success()'
[test/test] [DEBUG] expression 'success()' evaluated to 'true'
[test/test] 🚀  Start image=node:16-buster-slim
INFO[0000] Parallel tasks (0) below minimum, setting to 1
[test/test]   🐳  docker pull image=node:16-buster-slim platform= username= forcePull=true
[test/test] [DEBUG]   🐳  docker pull node:16-buster-slim
[test/test] [DEBUG] pulling image 'docker.io/library/node:16-buster-slim' ()
DEBU[0000] Saving notices etag=dbaa35d1-9292-40e1-92f5-fb5641929cf4
DEBU[0000] No new notices
[test/test] [DEBUG] Pulling from library/node :: 16-buster-slim
[test/test] [DEBUG] Digest: sha256:3ebf2875c188d22939c6ab080cfb1a4a6248cc86bae600ea8e2326aa03acdb8f ::
[test/test] [DEBUG] Status: Image is up to date for node:16-buster-slim ::
[test/test] [DEBUG] Removed container: 848c118d65f1d92b586012eb801004363367fc6eb3afd37594a4d448b88bba46
[test/test] [DEBUG]   🐳  docker volume rm act-test-test-24f46b2e65c2fc9b49cf0e305f210649cb0a45d5b5dc0a1380eb443748b7420b
[test/test] [DEBUG]   🐳  docker volume rm act-test-test-24f46b2e65c2fc9b49cf0e305f210649cb0a45d5b5dc0a1380eb443748b7420b-env
INFO[0001] Parallel tasks (0) below minimum, setting to 1
[test/test]   🐳  docker create image=node:16-buster-slim platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[test/test] [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=ARM64 RUNNER_TEMP=/tmp LANG=C.UTF-8] Cmd:[] Healthcheck:<nil> ArgsEscaped:false Image:node:16-buster-slim Volumes:map[] WorkingDir:/Users/jonj/projects/dynamic-uses Entrypoint:[] NetworkDisabled:false MacAddress: OnBuild:[] Labels:map[] StopSignal: StopTimeout:<nil> Shell:[]}
[test/test] [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:[] ConsoleSize:[0 0] Annotations:map[] 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: 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> ClusterOptions:<nil>} {Type:volume Source:act-test-test-24f46b2e65c2fc9b49cf0e305f210649cb0a45d5b5dc0a1380eb443748b7420b-env Target:/var/run/act ReadOnly:false Consistency: BindOptions:<nil> VolumeOptions:<nil> TmpfsOptions:<nil> ClusterOptions:<nil>} {Type:volume Source:act-test-test-24f46b2e65c2fc9b49cf0e305f210649cb0a45d5b5dc0a1380eb443748b7420b Target:/Users/jonj/projects/dynamic-uses ReadOnly:false Consistency: BindOptions:<nil> VolumeOptions:<nil> TmpfsOptions:<nil> ClusterOptions:<nil>}] MaskedPaths:[] ReadonlyPaths:[] Init:<nil>}
[test/test] [DEBUG] input.NetworkAliases ==> [test]
[test/test] [DEBUG] not a use defined config??
[test/test] [DEBUG] Created container name=act-test-test-24f46b2e65c2fc9b49cf0e305f210649cb0a45d5b5dc0a1380eb443748b7420b id=603f2da10548a8f86011c4c1544d702cb3552ff6cd7ad528bd38cb54fe9d3cc9 from image node:16-buster-slim (platform: )
[test/test] [DEBUG] ENV ==> [RUNNER_TOOL_CACHE=/opt/hostedtoolcache RUNNER_OS=Linux RUNNER_ARCH=ARM64 RUNNER_TEMP=/tmp LANG=C.UTF-8]
[test/test]   🐳  docker run image=node:16-buster-slim platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[test/test] [DEBUG] Starting container: 603f2da10548a8f86011c4c1544d702cb3552ff6cd7ad528bd38cb54fe9d3cc9
[test/test] [DEBUG] Started container: 603f2da10548a8f86011c4c1544d702cb3552ff6cd7ad528bd38cb54fe9d3cc9
[test/test] [DEBUG] Writing entry to tarball workflow/event.json len:2
[test/test] [DEBUG] Writing entry to tarball workflow/envs.txt len:0
[test/test] [DEBUG] Extracting content to '/var/run/act/'
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] setupEnv => map[ACT:true ACTIONS_CACHE_URL:http://172.24.80.44:61008/ CI:true 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_EVENT_NAME:push GITHUB_EVENT_PATH:/var/run/act/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_HEAD_REF: GITHUB_JOB:test GITHUB_REF:refs/heads/debug-act-bug7 GITHUB_REF_NAME:debug-act-bug7 GITHUB_REF_TYPE:branch GITHUB_REPOSITORY:jenseng/dynamic-uses GITHUB_REPOSITORY_OWNER:jenseng GITHUB_RETENTION_DAYS:0 GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA:d7575c48b4a2af48d97c7dd9c5480949c31ed622 GITHUB_WORKFLOW:test GITHUB_WORKSPACE:/Users/jonj/projects/dynamic-uses ImageOS:ubuntu20 RUNNER_PERFLOG:/dev/null RUNNER_TRACKING_ID:]
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] evaluating expression ''
[test/test] [DEBUG] expression '' evaluated to 'true'
[test/test] ⭐ Run Main mkdir ../action-outside-workspace
[test/test] [DEBUG] Writing entry to tarball workflow/outputcmd.txt len:0
[test/test] [DEBUG] Writing entry to tarball workflow/statecmd.txt len:0
[test/test] [DEBUG] Writing entry to tarball workflow/pathcmd.txt len:0
[test/test] [DEBUG] Writing entry to tarball workflow/envs.txt len:0
[test/test] [DEBUG] Writing entry to tarball workflow/SUMMARY.md len:0
[test/test] [DEBUG] Extracting content to '/var/run/act'
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] Wrote command

mkdir ../action-outside-workspace

 to 'workflow/0'
[test/test] [DEBUG] Writing entry to tarball workflow/0 len:35
[test/test] [DEBUG] Extracting content to '/var/run/act'
[test/test]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0] user= workdir=
[test/test] [DEBUG] Exec command '[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0]'
[test/test] [DEBUG] Working directory '/Users/jonj/projects/dynamic-uses'
[test/test]   ✅  Success - Main mkdir ../action-outside-workspace
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] setupEnv => map[ACT:true ACTIONS_CACHE_URL:http://172.24.80.44:61008/ CI:true GITHUB_ACTION:1 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_EVENT_NAME:push GITHUB_EVENT_PATH:/var/run/act/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_HEAD_REF: GITHUB_JOB:test GITHUB_REF:refs/heads/debug-act-bug7 GITHUB_REF_NAME:debug-act-bug7 GITHUB_REF_TYPE:branch GITHUB_REPOSITORY:jenseng/dynamic-uses GITHUB_REPOSITORY_OWNER:jenseng GITHUB_RETENTION_DAYS:0 GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA:d7575c48b4a2af48d97c7dd9c5480949c31ed622 GITHUB_WORKFLOW:test GITHUB_WORKSPACE:/Users/jonj/projects/dynamic-uses ImageOS:ubuntu20 RUNNER_PERFLOG:/dev/null RUNNER_TRACKING_ID:]
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] evaluating expression ''
[test/test] [DEBUG] expression '' evaluated to 'true'
[test/test] ⭐ Run Main cat <<-ACTIONEOF > ../action-outside-workspace/action.yml
name: test
runs:
  using: composite
  steps:
    - run: echo hello
      shell: bash
ACTIONEOF
[test/test] [DEBUG] Writing entry to tarball workflow/outputcmd.txt len:0
[test/test] [DEBUG] Writing entry to tarball workflow/statecmd.txt len:0
[test/test] [DEBUG] Writing entry to tarball workflow/pathcmd.txt len:0
[test/test] [DEBUG] Writing entry to tarball workflow/envs.txt len:0
[test/test] [DEBUG] Writing entry to tarball workflow/SUMMARY.md len:0
[test/test] [DEBUG] Extracting content to '/var/run/act'
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] Wrote command

cat <<-ACTIONEOF > ../action-outside-workspace/action.yml
name: test
runs:
  using: composite
  steps:
    - run: echo hello
      shell: bash
ACTIONEOF


 to 'workflow/1'
[test/test] [DEBUG] Writing entry to tarball workflow/1 len:155
[test/test] [DEBUG] Extracting content to '/var/run/act'
[test/test]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/1] user= workdir=
[test/test] [DEBUG] Exec command '[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/1]'
[test/test] [DEBUG] Working directory '/Users/jonj/projects/dynamic-uses'
[test/test]   ✅  Success - Main cat <<-ACTIONEOF > ../action-outside-workspace/action.yml
name: test
runs:
  using: composite
  steps:
    - run: echo hello
      shell: bash
ACTIONEOF
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] setupEnv => map[ACT:true ACTIONS_CACHE_URL:http://172.24.80.44:61008/ CI:true GITHUB_ACTION:2 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_EVENT_NAME:push GITHUB_EVENT_PATH:/var/run/act/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_HEAD_REF: GITHUB_JOB:test GITHUB_REF:refs/heads/debug-act-bug7 GITHUB_REF_NAME:debug-act-bug7 GITHUB_REF_TYPE:branch GITHUB_REPOSITORY:jenseng/dynamic-uses GITHUB_REPOSITORY_OWNER:jenseng GITHUB_RETENTION_DAYS:0 GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA:d7575c48b4a2af48d97c7dd9c5480949c31ed622 GITHUB_WORKFLOW:test GITHUB_WORKSPACE:/Users/jonj/projects/dynamic-uses ImageOS:ubuntu20 RUNNER_PERFLOG:/dev/null RUNNER_TRACKING_ID:]
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] evaluating expression ''
[test/test] [DEBUG] expression '' evaluated to 'true'
[test/test] ⭐ Run Main cat ../action-outside-workspace/action.yml
[test/test] [DEBUG] Writing entry to tarball workflow/outputcmd.txt len:0
[test/test] [DEBUG] Writing entry to tarball workflow/statecmd.txt len:0
[test/test] [DEBUG] Writing entry to tarball workflow/pathcmd.txt len:0
[test/test] [DEBUG] Writing entry to tarball workflow/envs.txt len:0
[test/test] [DEBUG] Writing entry to tarball workflow/SUMMARY.md len:0
[test/test] [DEBUG] Extracting content to '/var/run/act'
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] Wrote command

cat ../action-outside-workspace/action.yml

 to 'workflow/2'
[test/test] [DEBUG] Writing entry to tarball workflow/2 len:44
[test/test] [DEBUG] Extracting content to '/var/run/act'
[test/test]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/2] user= workdir=
[test/test] [DEBUG] Exec command '[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/2]'
[test/test] [DEBUG] Working directory '/Users/jonj/projects/dynamic-uses'
| name: test
| runs:
|   using: composite
|   steps:
|     - run: echo hello
|       shell: bash
[test/test]   ✅  Success - Main cat ../action-outside-workspace/action.yml
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] setupEnv => map[ACT:true ACTIONS_CACHE_URL:http://172.24.80.44:61008/ CI:true GITHUB_ACTION:3 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_EVENT_NAME:push GITHUB_EVENT_PATH:/var/run/act/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_HEAD_REF: GITHUB_JOB:test GITHUB_REF:refs/heads/debug-act-bug7 GITHUB_REF_NAME:debug-act-bug7 GITHUB_REF_TYPE:branch GITHUB_REPOSITORY:jenseng/dynamic-uses GITHUB_REPOSITORY_OWNER:jenseng GITHUB_RETENTION_DAYS:0 GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA:d7575c48b4a2af48d97c7dd9c5480949c31ed622 GITHUB_WORKFLOW:test GITHUB_WORKSPACE:/Users/jonj/projects/dynamic-uses ImageOS:ubuntu20 RUNNER_PERFLOG:/dev/null RUNNER_TRACKING_ID:]
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] evaluating expression ''
[test/test] [DEBUG] expression '' evaluated to 'true'
[test/test] ⭐ Run Main ./../action-outside-workspace
[test/test] [DEBUG] Writing entry to tarball workflow/outputcmd.txt len:0
[test/test] [DEBUG] Writing entry to tarball workflow/statecmd.txt len:0
[test/test] [DEBUG] Writing entry to tarball workflow/pathcmd.txt len:0
[test/test] [DEBUG] Writing entry to tarball workflow/envs.txt len:0
[test/test] [DEBUG] Writing entry to tarball workflow/SUMMARY.md len:0
[test/test] [DEBUG] Extracting content to '/var/run/act'
[test/test]   ❌  Failure - Main ./../action-outside-workspace
[test/test] file does not exist
[test/test] [DEBUG] skipping post step for './../action-outside-workspace': no action model available
[test/test] 🏁  Job failed
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
[test/test] [DEBUG] HEAD points to 'd7575c48b4a2af48d97c7dd9c5480949c31ed622'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug7
[test/test] [DEBUG] Found revision: d7575c48b4a2af48d97c7dd9c5480949c31ed622
Error: Job 'test' failed

Additional information

No response

@jenseng jenseng added the kind/bug Something isn't working label Nov 29, 2023
@jenseng jenseng linked a pull request Nov 29, 2023 that will close this issue
Copy link
Contributor

Issue is stale and will be closed in 14 days unless there is new activity

@github-actions github-actions bot added the stale label May 28, 2024
@jenseng
Copy link
Contributor Author

jenseng commented May 28, 2024

This is still broken on the latest act, making it behave inconsistently with GitHub Actions. The linked PR provides a possible fix

@github-actions github-actions bot removed the stale label May 29, 2024
@jsoref
Copy link
Contributor

jsoref commented Nov 4, 2024

Note that technically env isn't allowed in uses: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#env-context

You can retrieve the values of variables stored in env context and use these values in your workflow file. You can use the env context in any key in a workflow step except for the id and uses keys. For more information on the step syntax, see "Workflow syntax for GitHub Actions."

That said, I've run into github workflows that use this feature (uses: ./../something) (as I noted in: #1579 (comment)).

Whether people like it or not, this is a feature of the platform that's used by GitHub's own devs.

@ChristopherHX
Copy link
Contributor

ChristopherHX commented Nov 5, 2024

Note that technically env isn't allowed in uses:

We write an action.yml file to hardcoded well known folder which were we can use the env context or even use a native program to generate that.

I built a conditional action as well that allows dynamic uses via inputs.
That was at a time composite action only had uses without if.

A uses inside with inputs is just a normal input.

this is a feature of the platform

Depending on who you ask about this you get both yes and no as answer

e.g. ${{ insert }} is a feature, when I asked action/runner maintainer the answer was no this is not a supported feature and has no docs.

I never saw ./../ in the GitHub Docs anywhere and never had the idea to do that.

Local composite actions are sooo buggy, they leak their bugs into correctly working actions like you noticed yourself.

@jsoref
Copy link
Contributor

jsoref commented Nov 5, 2024

Oh yes.

Fwiw, check-spelling can rewrite its actions to work around the lack of expansion in actions. It's a handy workaround. Although I haven't used it yet. I'm quite tempted to use it to work around bugs in checkout, artifacts, and upload-sarif. (I've generally made PRs for each repository declaring my planned changes.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants