[GH-ISSUE #307] Cannot find local action #219

Closed
opened 2026-03-01 21:41:24 +03:00 by kerem · 8 comments
Owner

Originally created by @aeisenberg on GitHub (Jul 17, 2020).
Original GitHub issue: https://github.com/nektos/act/issues/307

I have a job that looks like this:

name: "Integration Testing"

on: [push, pull_request]

jobs:

  mock-job:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Move action
      shell: bash
      run: |
        mkdir ../action
        mv * .github ../action/
        mv ../action/tests/multi-language-repo/{*,.github} .
    - uses: ./../action/init

When I run this on CI, there are no problems. But, when I run this through act -j mock-job I get this error:

[Integration Testing/testing-job]   ❌  Failure - ./../action/init
Error: open /Users/andrew.eisenberg/repos/action/init/action.yaml: no such file or directory

Note that the init/action.yml file exists at /Users/andrew.eisenberg/repos/my-repo/init/action.yaml.

It looks like github is running the entire job inside of the docker container, whereas act is running some parts outside of it. Notably, it is looking for the action files on the host filesystem and the rest seems to be in the docker container.

Originally created by @aeisenberg on GitHub (Jul 17, 2020). Original GitHub issue: https://github.com/nektos/act/issues/307 I have a job that looks like this: ```yaml name: "Integration Testing" on: [push, pull_request] jobs: mock-job: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Move action shell: bash run: | mkdir ../action mv * .github ../action/ mv ../action/tests/multi-language-repo/{*,.github} . - uses: ./../action/init ``` When I run this on CI, there are no problems. But, when I run this through `act -j mock-job` I get this error: ```bash [Integration Testing/testing-job] ❌ Failure - ./../action/init Error: open /Users/andrew.eisenberg/repos/action/init/action.yaml: no such file or directory ``` Note that the `init/action.yml` file exists at `/Users/andrew.eisenberg/repos/my-repo/init/action.yaml`. It looks like github is running the entire job inside of the docker container, whereas act is running some parts outside of it. Notably, it is looking for the action files on the host filesystem and the rest seems to be in the docker container.
kerem 2026-03-01 21:41:24 +03:00
  • closed this issue
  • added the
    stale
    label
Author
Owner

@aeisenberg commented on GitHub (Jul 19, 2020):

My guess is that this line is incorrect:

github.com/nektos/act@64b8d2afa4/pkg/runner/step_context.go (L52)

It is using the local filesystem path to get to the action. But, I think it should be the path inside of the docker image.

<!-- gh-comment-id:660671352 --> @aeisenberg commented on GitHub (Jul 19, 2020): My guess is that this line is incorrect: https://github.com/nektos/act/blob/64b8d2afa47ff6938d7617e00f1260a95c35268e/pkg/runner/step_context.go#L52 It is using the local filesystem path to get to the action. But, I think it should be the path inside of the docker image.
Author
Owner

@benwinding commented on GitHub (Aug 17, 2020):

Seems to work if you set the reference to the local action from the root of the git folder

Github workflow

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - name: Run test action
      uses: ./my-actions/action1

Local action

├── /.github
│    └── workflows
└── /my-actions
     └── /action1
         ├── action.yaml
         └── Dockerfile
<!-- gh-comment-id:674686264 --> @benwinding commented on GitHub (Aug 17, 2020): Seems to work if you set the reference to the local action from the root of the `git` folder **Github workflow** ``` yaml jobs: test: runs-on: ubuntu-latest steps: - name: Run test action uses: ./my-actions/action1 ``` **Local action** ``` sh ├── /.github │ └── workflows └── /my-actions └── /action1 ├── action.yaml └── Dockerfile ```
Author
Owner

@aeisenberg commented on GitHub (Aug 17, 2020):

Thanks for your response, though if I do what you are suggesting, then I'm pretty sure that the workflow would fail when I run it on CI.

<!-- gh-comment-id:674998431 --> @aeisenberg commented on GitHub (Aug 17, 2020): Thanks for your response, though if I do what you are suggesting, then I'm pretty sure that the workflow would fail when I run it on CI.
Author
Owner

@github-actions[bot] commented on GitHub (Oct 17, 2020):

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

<!-- gh-comment-id:710708791 --> @github-actions[bot] commented on GitHub (Oct 17, 2020): Issue is stale and will be closed in 7 days unless there is new activity
Author
Owner

@addisonklinke commented on GitHub (Aug 14, 2022):

Still having trouble with this on act version 0.2.30. My repository has this structure

~/git/repository$ tree .github/
.github/
├── actions
│   └── setup-env.yaml
└── workflows
    └── pull_request_ci.yaml

Then within .github/workflows/pull_request_ci.yaml I try to use the action

jobs:
  example:
    runs-on: ubuntu-latest
    steps:
      - uses: ./.github/actions/setup-env.yaml

But triggering with act I still get

Failure - Main ./.github/actions/setup-env.yaml

I've tried both with and without the .yaml extension

<!-- gh-comment-id:1214459252 --> @addisonklinke commented on GitHub (Aug 14, 2022): Still having trouble with this on `act` version 0.2.30. My repository has this structure ``` ~/git/repository$ tree .github/ .github/ ├── actions │   └── setup-env.yaml └── workflows └── pull_request_ci.yaml ``` Then within `.github/workflows/pull_request_ci.yaml` I try to use the action ```yaml jobs: example: runs-on: ubuntu-latest steps: - uses: ./.github/actions/setup-env.yaml ``` But triggering with `act` I still get ``` Failure - Main ./.github/actions/setup-env.yaml ``` I've tried both with and without the `.yaml` extension
Author
Owner

@KnisterPeter commented on GitHub (Aug 15, 2022):

You need to checkout your repository to use local actions.

<!-- gh-comment-id:1214619135 --> @KnisterPeter commented on GitHub (Aug 15, 2022): You need to checkout your repository to use local actions.
Author
Owner

@ChristopherHX commented on GitHub (Aug 15, 2022):

Still having trouble with this on act version 0.2.30. My repository has this structure

~/git/repository$ tree .github/
.github/
├── actions
│   └── setup-env.yaml
└── workflows
    └── pull_request_ci.yaml

Then within .github/workflows/pull_request_ci.yaml I try to use the action

jobs:
  example:
    runs-on: ubuntu-latest
    steps:
      - uses: ./.github/actions/setup-env.yaml

But triggering with act I still get

Failure - Main ./.github/actions/setup-env.yaml

I've tried both with and without the .yaml extension

Both your repository structure and uses syntax are wrong, this wouldn't work on github.

You have to change it to

~/git/repository$ tree .github/
.github/
├── actions
│   └── setup-env
│        └── action.yaml
└── workflows
    └── pull_request_ci.yaml
jobs:
  example:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: ./.github/actions/setup-env

EDIT you can also use both action.yaml and action.yml

<!-- gh-comment-id:1215300182 --> @ChristopherHX commented on GitHub (Aug 15, 2022): > Still having trouble with this on `act` version 0.2.30. My repository has this structure > > ``` > ~/git/repository$ tree .github/ > .github/ > ├── actions > │   └── setup-env.yaml > └── workflows > └── pull_request_ci.yaml > ``` > > Then within `.github/workflows/pull_request_ci.yaml` I try to use the action > > ```yaml > jobs: > example: > runs-on: ubuntu-latest > steps: > - uses: ./.github/actions/setup-env.yaml > ``` > > But triggering with `act` I still get > > ``` > Failure - Main ./.github/actions/setup-env.yaml > ``` > > I've tried both with and without the `.yaml` extension Both your repository structure and uses syntax are wrong, this wouldn't work on github. You have to change it to > ``` > ~/git/repository$ tree .github/ > .github/ > ├── actions > │   └── setup-env > │   └── action.yaml > └── workflows > └── pull_request_ci.yaml > ``` > > ```yaml > jobs: > example: > runs-on: ubuntu-latest > steps: > - uses: actions/checkout@v3 > - uses: ./.github/actions/setup-env > ``` **EDIT** you can also use both `action.yaml` and `action.yml`
Author
Owner

@addisonklinke commented on GitHub (Aug 22, 2022):

@KnisterPeter @ChristopherHX thanks for the tips! After adding actions/checkout and restructuring the local setup-env/action.yaml, it is working

<!-- gh-comment-id:1222584540 --> @addisonklinke commented on GitHub (Aug 22, 2022): @KnisterPeter @ChristopherHX thanks for the tips! After adding `actions/checkout` and restructuring the local `setup-env/action.yaml`, it is working
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#219
No description provided.