[GH-ISSUE #550] Issue: Can't use action from repo checked out with actions/checkout #372

Closed
opened 2026-03-01 21:42:45 +03:00 by kerem · 15 comments
Owner

Originally created by @kylegibson-rldatix on GitHub (Mar 3, 2021).
Original GitHub issue: https://github.com/nektos/act/issues/550

Act version

❯ act --version
act version 0.2.20

Expected behaviour

Expected to be able to locally test a github action workflow that checks out a repo containing another action, and then executes that action in the runner env with uses

Actual behaviour

act fails with error message Error: open /home/*****/gh-action-test-repo/example/action.yaml: no such file or directory

While the repo is sucessfully checked out to the runner env, it appears that act does not look within the runner env when evaluating local uses.

Workflow and/or repository

foo/example is not a real repository.

workflow
on:
  workflow_dispatch:
  push:
    branches:
      - master

jobs:
  track:
    runs-on: ubuntu-latest
    steps:
      - name: Example
        uses: actions/checkout@v2
        with:
          repository: foo/example
          ref: 'master'
          token: ${{ secrets.TOKEN }}
          path: example

      - uses: ./example

Steps to reproduce

act output

I've scrubbed sensitive information from the log below.

Log
❯ act workflow_dispatch -j track
[track_updates.yml/track] 🚀  Start image=catthehacker/ubuntu:act-latest
[track_updates.yml/track]   🐳  docker run image=catthehacker/ubuntu:act-latest entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[track_updates.yml/track] ⭐  Run actions/checkout@v2
[track_updates.yml/track]   ☁  git clone 'https://github.com/actions/checkout' # ref=v2
[track_updates.yml/track]   🐳  docker cp src=/home/*****/.cache/act/actions-checkout@v2 dst=/actions/
[track_updates.yml/track]   ❓  ::save-state name=isPost,::true
[track_updates.yml/track]   💬  ::debug::GITHUB_WORKSPACE = '/github/workspace'
[track_updates.yml/track]   💬  ::debug::qualified repository = '*****/example'
[track_updates.yml/track]   💬  ::debug::ref = 'master'
[track_updates.yml/track]   💬  ::debug::commit = 'undefined'
[track_updates.yml/track]   💬  ::debug::clean = true
[track_updates.yml/track]   💬  ::debug::fetch depth = 1
[track_updates.yml/track]   💬  ::debug::lfs = false
[track_updates.yml/track]   💬  ::debug::submodules = false
[track_updates.yml/track]   💬  ::debug::recursive submodules = false
[track_updates.yml/track]   ❓  ::add-matcher::/actions/actions-checkout@v2/dist/problem-matcher.json
| Syncing repository: *****/example
[track_updates.yml/track]   ❓  ::group::Getting Git version info
| Working directory is '/github/workspace/example'
[track_updates.yml/track]   💬  ::debug::Getting git version
| [command]/usr/bin/git version
| git version 2.17.1
[track_updates.yml/track]   ❓  ::endgroup::
| The repository will be downloaded using the GitHub REST API
| To create a local Git repository instead, add Git 2.18 or higher to the PATH
| Downloading the archive
| Writing archive to disk
| Extracting the archive
| [command]/bin/tar xz -C /github/workspace/example/55a2a4cd-1017-460a-aa87-2f9fe0403a6d -f /github/workspace/example/55a2a4cd-1017-460a-aa87-2f9fe0403a6d.tar.gz
| Resolved version *****-example-bd7968a95c64507048d8f41ce61fbd33030a69ce
[track_updates.yml/track]   ❓  ::remove-matcher owner=checkout-git,::
[track_updates.yml/track]   ✅  Success - actions/checkout@v2
[track_updates.yml/track] ⭐  Run ./example
[track_updates.yml/track]   ❌  Failure - ./example
Error: open /home/*****/gh-action-test-repo/example/action.yaml: no such file or directory

Originally created by @kylegibson-rldatix on GitHub (Mar 3, 2021). Original GitHub issue: https://github.com/nektos/act/issues/550 ## Act version ```none ❯ act --version act version 0.2.20 ``` ## Expected behaviour Expected to be able to locally test a github action workflow that checks out a repo containing another action, and then executes that action in the runner env with `uses` ## Actual behaviour `act` fails with error message `Error: open /home/*****/gh-action-test-repo/example/action.yaml: no such file or directory` **While the repo is sucessfully checked out to the runner env, it appears that `act` does not look within the runner env when evaluating local `uses`.** ## Workflow and/or repository `foo/example` is not a real repository. <details> <summary>workflow</summary> ```none on: workflow_dispatch: push: branches: - master jobs: track: runs-on: ubuntu-latest steps: - name: Example uses: actions/checkout@v2 with: repository: foo/example ref: 'master' token: ${{ secrets.TOKEN }} path: example - uses: ./example ``` </details> ## Steps to reproduce ## `act` output I've scrubbed sensitive information from the log below. <details> <summary>Log</summary> ```none ❯ act workflow_dispatch -j track [track_updates.yml/track] 🚀 Start image=catthehacker/ubuntu:act-latest [track_updates.yml/track] 🐳 docker run image=catthehacker/ubuntu:act-latest entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [track_updates.yml/track] ⭐ Run actions/checkout@v2 [track_updates.yml/track] ☁ git clone 'https://github.com/actions/checkout' # ref=v2 [track_updates.yml/track] 🐳 docker cp src=/home/*****/.cache/act/actions-checkout@v2 dst=/actions/ [track_updates.yml/track] ❓ ::save-state name=isPost,::true [track_updates.yml/track] 💬 ::debug::GITHUB_WORKSPACE = '/github/workspace' [track_updates.yml/track] 💬 ::debug::qualified repository = '*****/example' [track_updates.yml/track] 💬 ::debug::ref = 'master' [track_updates.yml/track] 💬 ::debug::commit = 'undefined' [track_updates.yml/track] 💬 ::debug::clean = true [track_updates.yml/track] 💬 ::debug::fetch depth = 1 [track_updates.yml/track] 💬 ::debug::lfs = false [track_updates.yml/track] 💬 ::debug::submodules = false [track_updates.yml/track] 💬 ::debug::recursive submodules = false [track_updates.yml/track] ❓ ::add-matcher::/actions/actions-checkout@v2/dist/problem-matcher.json | Syncing repository: *****/example [track_updates.yml/track] ❓ ::group::Getting Git version info | Working directory is '/github/workspace/example' [track_updates.yml/track] 💬 ::debug::Getting git version | [command]/usr/bin/git version | git version 2.17.1 [track_updates.yml/track] ❓ ::endgroup:: | The repository will be downloaded using the GitHub REST API | To create a local Git repository instead, add Git 2.18 or higher to the PATH | Downloading the archive | Writing archive to disk | Extracting the archive | [command]/bin/tar xz -C /github/workspace/example/55a2a4cd-1017-460a-aa87-2f9fe0403a6d -f /github/workspace/example/55a2a4cd-1017-460a-aa87-2f9fe0403a6d.tar.gz | Resolved version *****-example-bd7968a95c64507048d8f41ce61fbd33030a69ce [track_updates.yml/track] ❓ ::remove-matcher owner=checkout-git,:: [track_updates.yml/track] ✅ Success - actions/checkout@v2 [track_updates.yml/track] ⭐ Run ./example [track_updates.yml/track] ❌ Failure - ./example Error: open /home/*****/gh-action-test-repo/example/action.yaml: no such file or directory ``` </details>
Author
Owner

@dannystaple commented on GitHub (Mar 5, 2021):

This limits being able to do the workaround in https://github.community/t/github-action-action-in-private-repository/16063/15.

<!-- gh-comment-id:791514606 --> @dannystaple commented on GitHub (Mar 5, 2021): This limits being able to do the workaround in https://github.community/t/github-action-action-in-private-repository/16063/15.
Author
Owner

@mikemonkers commented on GitHub (Mar 5, 2021):

I also see this issue as described above. It certainly makes testing composite actions in a separate repo seemingly impossible.

<!-- gh-comment-id:791515616 --> @mikemonkers commented on GitHub (Mar 5, 2021): I also see this issue as described above. It certainly makes testing composite actions in a separate repo seemingly impossible.
Author
Owner

@jsoref commented on GitHub (Apr 4, 2021):

For reference, this has nothing to do with checkouts per se. And nothing to do with private repositories.

https://github.com/jsoref/nektos-act-issues-550/runs/2263398812?check_suite_focus=true

on:
  workflow_dispatch:
  push:

jobs:
  local-action:
    runs-on: ubuntu-latest
    steps:
      - name: action-checkout-gha
        if: github.actor != 'nektos/act'
        run: sudo apt-get update -qq > /dev/null 2>/dev/null && sudo apt-get install -qq -y curl ca-certificates unzip > /dev/null 2>/dev/null && curl -L https://github.com/actions/hello-world-javascript-action/archive/refs/heads/main.zip -o example.zip && unzip example.zip -d dummy && mv dummy/* example && rm example.zip && rmdir dummy
      - name: action-checkout-act
        if: github.actor == 'nektos/act'
        run: apt-get update -qq > /dev/null 2>/dev/null && apt-get install -qq -y curl ca-certificates unzip > /dev/null 2>/dev/null && curl -L https://github.com/actions/hello-world-javascript-action/archive/refs/heads/main.zip -o example.zip && unzip example.zip -d dummy && mv dummy/* example && rm example.zip && rmdir dummy

      - uses: ./example
        with:
          who-to-greet: 'Mona the Octocat'

Fwiw, the reason I'm using curl instead of checkout here is that I don't seem to have a token that makes github's checkout action happy. But, it does conveniently show that the problem isn't relating to checking out :-).

The problem is that the code that looks for action.yml/action.yaml isn't looking inside the container:
github.com/nektos/act@b9a7bc6202/pkg/runner/step_context.go (L309-L311)

Generally fixing things in act isn't particularly hard, so if someone wants to give it a try, they're welcome to.

This isn't a problem I'm hitting, so it isn't high on my list (I'm not a member of act fwiw, I'm just trying to clean things up for some of my own workflows).

<!-- gh-comment-id:812992982 --> @jsoref commented on GitHub (Apr 4, 2021): For reference, this has nothing to do with checkouts per se. And nothing to do with private repositories. https://github.com/jsoref/nektos-act-issues-550/runs/2263398812?check_suite_focus=true ```yaml on: workflow_dispatch: push: jobs: local-action: runs-on: ubuntu-latest steps: - name: action-checkout-gha if: github.actor != 'nektos/act' run: sudo apt-get update -qq > /dev/null 2>/dev/null && sudo apt-get install -qq -y curl ca-certificates unzip > /dev/null 2>/dev/null && curl -L https://github.com/actions/hello-world-javascript-action/archive/refs/heads/main.zip -o example.zip && unzip example.zip -d dummy && mv dummy/* example && rm example.zip && rmdir dummy - name: action-checkout-act if: github.actor == 'nektos/act' run: apt-get update -qq > /dev/null 2>/dev/null && apt-get install -qq -y curl ca-certificates unzip > /dev/null 2>/dev/null && curl -L https://github.com/actions/hello-world-javascript-action/archive/refs/heads/main.zip -o example.zip && unzip example.zip -d dummy && mv dummy/* example && rm example.zip && rmdir dummy - uses: ./example with: who-to-greet: 'Mona the Octocat' ``` Fwiw, the reason I'm using curl instead of checkout here is that I don't seem to have a token that makes github's checkout action happy. But, it does conveniently show that the problem isn't relating to checking out :-). The problem is that the code that looks for action.yml/action.yaml isn't looking inside the container: https://github.com/nektos/act/blob/b9a7bc620228df56dcc0684f09391ea481c9fb04/pkg/runner/step_context.go#L309-L311 Generally fixing things in act isn't particularly hard, so if someone wants to give it a try, they're welcome to. This isn't a problem I'm hitting, so it isn't high on my list (I'm not a member of act fwiw, I'm just trying to clean things up for some of my own workflows).
Author
Owner

@metamoof commented on GitHub (Apr 5, 2021):

I'm also seeing this, both in ubuntu and windows

<!-- gh-comment-id:813495751 --> @metamoof commented on GitHub (Apr 5, 2021): I'm also seeing this, both in ubuntu and windows
Author
Owner

@github-actions[bot] commented on GitHub (May 6, 2021):

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

<!-- gh-comment-id:833125158 --> @github-actions[bot] commented on GitHub (May 6, 2021): Issue is stale and will be closed in 14 days unless there is new activity
Author
Owner

@dannystaple commented on GitHub (May 10, 2021):

This doesn't appear to be fixed yet.

<!-- gh-comment-id:836892169 --> @dannystaple commented on GitHub (May 10, 2021): This doesn't appear to be fixed yet.
Author
Owner

@jsoref commented on GitHub (May 10, 2021):

What version of act are you using? (Please always include that detail, and preferably a workflow reference)

(I'm not saying it is/isn't, it's just helpful to be able to check/compare.)

<!-- gh-comment-id:836910468 --> @jsoref commented on GitHub (May 10, 2021): What version of act are you using? (Please always include that detail, and preferably a workflow reference) (I'm not saying it is/isn't, it's just helpful to be able to check/compare.)
Author
Owner

@MK-Draft-f0 commented on GitHub (Jun 2, 2021):

Bump!! I get this issue too, tried to symlink (ln -s ./action.yml action.yaml) the file and still get same error!
Run Terraform Setup
Failure - Terraform Setup
Error: open C:\Users\redacted\Desktop\repos\redacted.actions\github-action-setup-terraform\action.yaml: The system cannot find the path specified.

Version is @latest currently @v0.2.22

<!-- gh-comment-id:853273565 --> @MK-Draft-f0 commented on GitHub (Jun 2, 2021): Bump!! I get this issue too, tried to symlink (ln -s ./action.yml action.yaml) the file and still get same error! ⭐ Run Terraform Setup ❌ Failure - Terraform Setup Error: open C:\Users\redacted\Desktop\repos\redacted\.actions\github-action-setup-terraform\action.yaml: The system cannot find the path specified. Version is @latest currently @v0.2.22
Author
Owner

@jsoref commented on GitHub (Jun 2, 2021):

@fdxmk

What version of act are you using? (Please always include that detail, and preferably a workflow reference)

(I'm not saying it is/isn't, it's just helpful to be able to check/compare.)

<!-- gh-comment-id:853285143 --> @jsoref commented on GitHub (Jun 2, 2021): @fdxmk > What version of act are you using? (Please always include that detail, and preferably a workflow reference) > > (I'm not saying it is/isn't, it's just helpful to be able to check/compare.)
Author
Owner

@MK-Draft-f0 commented on GitHub (Jun 2, 2021):

Tried v0.2.22-18 seen somewhere (issue 567) .20 did not have issue but not true for this issue, on windows x64

jist of it is

jobs:
  terragrunt:
    name: 'Terragrunt'
    runs-on: ubuntu-latest
    steps:
      - name: 'Checkout'
        uses: actions/checkout@v2
		
      - name: 'Checkout Terraform Setup Action'
        uses: actions/checkout@v2
        with:
          repository: redacated/github-action-setup-terraform 
          token: ${{ secrets.redacted }}
          path: .actions/github-action-setup-terraform	
          #REF: https://github.com/hashicorp/setup-terraform #have mirrored this	  
		  
      - name: 'Terraform Setup'
        env: 
        uses: ./.actions/github-action-setup-terraform
        with:
          cli_config_credentials_token: ${{ secrets.redacted }}
          cli_config_credentials_hostname: 'tfe.redacted'
          terraform_version: ${{ env.tf_version }}	
<!-- gh-comment-id:853336994 --> @MK-Draft-f0 commented on GitHub (Jun 2, 2021): Tried v0.2.22-18 seen somewhere (issue 567) .20 did not have issue but not true for this issue, on windows x64 jist of it is ``` jobs: terragrunt: name: 'Terragrunt' runs-on: ubuntu-latest steps: - name: 'Checkout' uses: actions/checkout@v2 - name: 'Checkout Terraform Setup Action' uses: actions/checkout@v2 with: repository: redacated/github-action-setup-terraform token: ${{ secrets.redacted }} path: .actions/github-action-setup-terraform #REF: https://github.com/hashicorp/setup-terraform #have mirrored this - name: 'Terraform Setup' env: uses: ./.actions/github-action-setup-terraform with: cli_config_credentials_token: ${{ secrets.redacted }} cli_config_credentials_hostname: 'tfe.redacted' terraform_version: ${{ env.tf_version }} ```
Author
Owner

@MK-Draft-f0 commented on GitHub (Jun 2, 2021):

tried snapshot 680, 702, 712 issue persists on those too

<!-- gh-comment-id:853343666 --> @MK-Draft-f0 commented on GitHub (Jun 2, 2021): tried snapshot 680, 702, 712 issue persists on those too
Author
Owner

@MK-Draft-f0 commented on GitHub (Jun 2, 2021):

Also tried .22 & .20 on linux x64 chromebook, same issue!

<!-- gh-comment-id:853379883 --> @MK-Draft-f0 commented on GitHub (Jun 2, 2021): Also tried .22 & .20 on linux x64 chromebook, same issue!
Author
Owner

@MK-Draft-f0 commented on GitHub (Jun 3, 2021):

If I switch the uses to a remote location it works fine, however I cannot do that in my environment, have to use a local, so how do I work around this in the interim??

      - name: 'Terraform Setup'
        env: 
        #uses: ./.actions/github-action-setup-terraform
        uses: hashicorp/setup-terraform@main
        with:
          cli_config_credentials_token: ${{ secrets.redacted }}
          cli_config_credentials_hostname: 'tfe.redacted'
          terraform_version: ${{ env.tf_version }}
<!-- gh-comment-id:853736943 --> @MK-Draft-f0 commented on GitHub (Jun 3, 2021): If I switch the uses to a remote location it works fine, however I cannot do that in my environment, have to use a local, so how do I work around this in the interim?? ``` - name: 'Terraform Setup' env: #uses: ./.actions/github-action-setup-terraform uses: hashicorp/setup-terraform@main with: cli_config_credentials_token: ${{ secrets.redacted }} cli_config_credentials_hostname: 'tfe.redacted' terraform_version: ${{ env.tf_version }} ```
Author
Owner

@jsoref commented on GitHub (Jun 3, 2021):

If you're desperate you could probably use inception (i.e. run act inside act). Or just commit the action into your repository.

My guess is that the uses: parser is looking for stuff from the outside / in a cache directory instead of in the workspace directory. But I don't have the energy to check right now (I'm currently working on my own action).

<!-- gh-comment-id:853740150 --> @jsoref commented on GitHub (Jun 3, 2021): If you're desperate you could probably use inception (i.e. run act inside act). Or just commit the action into your repository. My guess is that the `uses:` parser is looking for stuff from the outside / in a cache directory instead of in the workspace directory. But I don't have the energy to check right now (I'm currently working on my own action).
Author
Owner

@github-actions[bot] commented on GitHub (Jul 4, 2021):

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

<!-- gh-comment-id:873487445 --> @github-actions[bot] commented on GitHub (Jul 4, 2021): Issue is stale and will be closed in 14 days unless there is new activity
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#372
No description provided.