e-square-io / nx-github-actions

A set of Github Actions for NX workspaces
MIT License
30 stars 6 forks source link

Nx v15 support #61

Closed robinpellegrims closed 1 year ago

robinpellegrims commented 1 year ago

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[X] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

After updating my repository to nx v15, the nx-distributed-task action throws the following error for test, lint, e2e targets (seems to work for build):

TypeError: Cannot read properties of undefined (reading 'some')
    at exports.shouldRunWithDeps (/home/runner/work/_actions/e-square-io/nx-distributed-task/v2/main.js:29:805582)
Error: Unhandled error: TypeError: Cannot read properties of undefined (reading 'some')
    at exports.getInputs (/home/runner/work/_actions/e-square-io/nx-distributed-task/v2/main.js:29:793123)
    at exports.default (/home/runner/work/_actions/e-square-io/nx-distributed-task/v2/main.js:29:6520556)
    at eval (eval at callAsyncFunction (/home/runner/work/_actions/actions/github-script/v6/dist/index.js:13356:16), <anonymous>:18:7)
    at callAsyncFunction (/home/runner/work/_actions/actions/github-script/v6/dist/index.js:13357:12)
    at main (/home/runner/work/_actions/actions/github-script/v6/dist/index.js:13452:26)
    at Module.858 (/home/runner/work/_actions/actions/github-script/v6/dist/index.js:13429:1)
    at __webpack_require__ (/home/runner/work/_actions/actions/github-script/v6/dist/index.js:24:31)
    at startup (/home/runner/work/_actions/actions/github-script/v6/dist/index.js:43:19)
    at /home/runner/work/_actions/actions/github-script/v6/dist/index.js:[49](https://github.com/robinpellegrims/pellegrims/actions/runs/3446855679/jobs/5752274744#step:4:51):18

My nx.json was updated by the migration scripts and the targetDefaults property now looks like this:

  "targetDefaults": {
    "build": {
      "dependsOn": ["^build"],
      "inputs": ["production", "^production"]
    },
    "e2e": {
      "inputs": ["default", "^production"]
    },
    "test": {
      "inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"]
    },
    "lint": {
      "inputs": ["default", "{workspaceRoot}/.eslintrc.json"]
    }
  },

Expected behavior

The action should work like for nx v14 repositories

Minimal reproduction of the problem with instructions

Update a nx v14 repository to v15

Environment


- Nx version: 15.0.13 
- Node version: 14  
ronnetzer commented 1 year ago

fixed by #64

robinpellegrims commented 1 year ago

Thanks, this solves my problem!