github-actions-demo icon indicating copy to clipboard operation
github-actions-demo copied to clipboard

Cloning the repo and running act

Open vikmn opened this issue 4 years ago • 3 comments

I am just starting on trying to use act. However on cloning the repo and running act on a windows machine I get the following error Cannot find module '/github/workspace/\actions\actions-setup-node@v1\dist\index.js'

Full error log here

[CI/test]   �  docker run image=node:12.6-buster-slim entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[CI/test]   �  docker cp src=C:\code\github-actions-demo/. dst=\github\workspace
[CI/test] ⭐  Run actions/checkout@v2
[CI/test]   ✅  Success - actions/checkout@v2
[CI/test] ⭐  Run actions/setup-node@v1
[CI/test]   ☁  git clone 'https://github.com/actions/setup-node' # ref=v1
[CI/test]   �  docker cp src=C:\Users\vikram.nadig\.cache\act/actions-setup-node@v1 dst=/actions\
| internal/modules/cjs/loader.js:628
|     throw err;
|     ^
|
| Error: Cannot find module '/github/workspace/\actions\actions-setup-node@v1\dist\index.js'
|     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:625:15)
|     at Function.Module._load (internal/modules/cjs/loader.js:527:27)
|     at Function.Module.runMain (internal/modules/cjs/loader.js:839:10)
|     at internal/main/run_main_module.js:17:11 {
|   code: 'MODULE_NOT_FOUND',
|   requireStack: []
| }
[CI/test]   ❌  Failure - actions/setup-node@v1
Error: exit with `FAILURE`: 1

Is there something i am missing ?

vikmn avatar Jul 15 '20 11:07 vikmn

Same occurs for me (Windows 10, act ver.0.2.9).

I did not use the official example, but my own project file:

See my .github/workflows/build.yml
jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/[email protected]
    # below fails
      - name: Set up Python
        uses: actions/setup-python@v2
See result
[CI/build] ⭐  Run actions/[email protected]
[CI/build]   ✅  Success - actions/[email protected]
[CI/build] ⭐  Run actions/setup-python@v2
[CI/build]   ☁  git clone 'https://github.com/actions/setup-python' # ref=v2
[CI/build]   �🐳  docker cp src=act/actions-setup-python@v2 dst=/actions\
| internal/modules/cjs/loader.js:628
|     throw err;
|     ^
|
| Error: Cannot find module '/github/workspace/\actions\actions-setup-python@v2\dist\i
ndex.js'
|     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:625:15)

|     at Function.Module._load (internal/modules/cjs/loader.js:527:27)      
|     at Function.Module.runMain (internal/modules/cjs/loader.js:839:10)    
|     at internal/main/run_main_module.js:17:11 {
|   code: 'MODULE_NOT_FOUND',
|   requireStack: []
| }
[CI/build]   ❌  Failure - actions/setup-python@v2

kinafu avatar Sep 22 '20 09:09 kinafu

@kinafu I believe that it is related to this issue: https://github.com/nektos/act/issues/228

According to the project README: https://github.com/nektos/act#known-issues

MODULE_NOT_FOUND during docker cp command #228

  - name: Checkout
    uses: actions/checkout@v2
    with:
      path: "your-action-root-directory"

I'm still confused about what the action-root-directory should be.

In my case, my folder is structured like this:

.github/
├── _dev
│   ├── event-data
│   │   ├── README.md
│   │   ├── pull-request.json
│   │   ├── push-develop.json
│   │   ├── push-test.json
│   │   └── workflow-dispatch.json
│   ├── .secrets
│   ├── .secrets.template
│   ├── README.md
│   ├── debugContext.sh
│   └── executeWorkflow.sh
├── actions
│   ├── ctf-changelist-sync
│   │   ├── dist
│   │   │   ├── index.js
│   │   │   ├── index.js.map
│   │   │   ├── licenses.txt
│   │   │   └── sourcemap-register.js
│   │   ├── README.md
│   │   └── action.yml
│   └── sentry-add-release.sh
└── workflows
    └── _scratch
        ├── debug-context.yml
        ├── dev-custom-action.yml
        └── dev-workflow.yml

yan-kisen avatar Oct 07 '20 04:10 yan-kisen

Note that was only an issue when I tried to create a new action inside of the .github/actions/ of an entirely separate repository (out of laziness)

In the end, I created a separate repo for my action & am able to execute a self referencing act workflow.

https://github.com/yan-kisen/ctf-changelist-sync

yan-kisen avatar Oct 07 '20 04:10 yan-kisen