-
Notifications
You must be signed in to change notification settings - Fork 6
Affected matrix generation fail with: Cannot read properties of undefined (reading 'endsWith') #53
Comments
@robinpellegrims and @ronnetzer thank you very much your response in advance 👍 |
Hi @tamascsaba, Thank you for reporting the issue,
|
I'm having the same issue after converting all projects to use separate project.json files instead of the global workspace.json. Might be related to this library still using nx v13? Can we update the nx packages to v14? |
Sorry for the late response, but I haven't had time to create an example repository, but maybe I can give you a general description of our project.
|
@robinpellegrims Thanks for reporting, @tamascsaba Regarding your 2nd point, do you mind opening it in a separate issue? its unrelated to this one |
I created a minimal reproduction repository here. It's a fresh nx repository created using I hope this helps, let me know if you need anything else. |
I opened a separate issue: #56 as well. |
I am having this exact issue with a react-native monorepo that has 9 apps already in place. I have been trying to understand what I'm missing. What's the process that this action goes through to determine the affected matrix? |
Apparently this is something in NX, nrwl/nx#8968 as a workaround, please add you can check this fixed minimal reproduction https://github.com/ronnetzer/nx-github-actions-error (cloned from @robinpellegrims's repro) Please let me know if this fixed is not working for you @jason-edstrom @tamascsaba @robinpellegrims |
I have more than 200 |
@tamascsaba This is something that can be managed with a simple search & replace, in any case updating to 14 will take time and I can't guarantee that it will be started anytime soon. Also, there are some issues that block the update, the biggest one is migrating back from github-script action to standalone shell scripts, after that I'll need to do some cleanup of NX internal code I had to overwrite in order to use it in github-script. I will probably have more time to get into this update after the holidays season in Israel (around November) |
@ronnetzer thank you very much your informations. I really appreciate your quick feedback 👍 |
For those who don't want to deal with the setup:
runs-on: ubuntu-latest
name: Affected Matrix
outputs:
hasChanges: ${{ steps.affected.outputs.hasChanges }}
matrix: ${{ steps.affected.outputs.matrix }}
steps:
- name: ⬇️ Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: fix https://github.com/e-square-io/nx-github-actions/issues/53
run: >
addRoot() {
ROOT_PATH=$(dirname "$1")
PROJECT_CONTENT=$(jq ". + {root: \"${ROOT_PATH}\"}" < "$1")
echo "$PROJECT_CONTENT" > "$1"
};
find apps -name project.json | while read file; do addRoot "$file"; done;
find libs -name project.json | while read file; do addRoot "$file"; done;
find tools -name project.json | while read file; do addRoot "$file"; done;
shell: bash
- name: Calculate affected projects
uses: e-square-io/nx-affected-matrix@v2
id: affected
with:
targets: 'lint,test,build'
maxDistribution: 3
checkout: false |
Current behavior
Affected matrix generation fail with:
Minimal reproduction of the problem with instructions
I had to add
NX_WORKSPACE_ROOT_PATH
, becauseworkingDirectory
is not working.My configuration looks like:
I am using nx
14.4.2
with version 2 projects format.The text was updated successfully, but these errors were encountered: