fastly / compute-actions

GitHub Actions for building on Fastly Compute.
https://www.fastly.com/blog/introducing-github-actions-for-compute-edge-a-new-resource-to-help-ship-code
MIT License
40 stars 9 forks source link

fastly/compute-actions/setup errors when testing locally with act #13

Open torch2424 opened 2 years ago

torch2424 commented 2 years ago

Across multiple C@E SDK Github Actions, we use act to test our Github Actions locally. 😄 I currently have a a snippet that I use to install the Fastly CLI, but I want to use the fastly/compute-actions/setup to always get the latest CLI version. fastly/compute-actions/setup works fine when I run it on Github Actions, but breaks in my local testing. 😢

Example

I had the following snippet in my Github Action:

- name: Set up Fastly CLI
      uses: fastly/compute-actions/setup@main
      with:
        cli_version: '1.7.0' # optional, defaults to 'latest'

Which produced the following act logs:

[Compute TinyGo SDK Test/sdktest] ⭐  Run Set up Fastly CLI
INFO[0080]   ☁  git clone 'https://github.com/fastly/compute-actions' # ref=main 
[Compute TinyGo SDK Test/sdktest]   🐳  docker cp src=/home/torch2424/.cache/act/fastly-compute-actions-setup@main/setup/ dst=/var/run/act/actions/fastly-compute-actions-setup@main/setup/
[Compute TinyGo SDK Test/sdktest]   🐳  docker exec cmd=[mkdir -p /var/run/act/actions/fastly-compute-actions-setup@main/setup/] user=
[Compute TinyGo SDK Test/sdktest]   🐳  docker exec cmd=[node /var/run/act/actions/fastly-compute-actions-setup@main/setup/index.js] user=
| internal/modules/cjs/loader.js:892
|   throw err;
|   ^
| 
| Error: Cannot find module '@actions/core'
| Require stack:
| - /run/act/actions/fastly-compute-actions-setup@main/setup/index.js
|     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
|     at Function.Module._load (internal/modules/cjs/loader.js:745:27)
|     at Module.require (internal/modules/cjs/loader.js:961:19)
|     at require (internal/modules/cjs/helpers.js:92:18)
|     at Object.<anonymous> (/run/act/actions/fastly-compute-actions-setup@main/setup/index.js:1:14)
|     at Module._compile (internal/modules/cjs/loader.js:1072:14)
|     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
|     at Module.load (internal/modules/cjs/loader.js:937:32)
|     at Function.Module._load (internal/modules/cjs/loader.js:778:12)
|     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) {
|   code: 'MODULE_NOT_FOUND',
|   requireStack: [
|     '/run/act/actions/fastly-compute-actions-setup@main/setup/index.js'
|   ]
| }
[Compute TinyGo SDK Test/sdktest]   ❌  Failure - Set up Fastly CLI
Error: exit with `FAILURE`: 1

If I had to guess, I think the issue might be that you are committing your node_modules directory? Which I do understand is recommended by Github, but they also mention it can cause problems, and they reccomended @vercel/ncc even more so. 🤔

Let me know if I can help! 😄 🙏🏾