intuit / auto

Generate releases based on semantic version labels on pull requests.
https://intuit.github.io/auto/
MIT License
2.25k stars 202 forks source link

`.nx/` makes all-contributors plugin think info has changed, crashes pipeline #2457

Open KVSRoyal opened 4 months ago

KVSRoyal commented 4 months ago

Describe the bug

I am unable to find any mentions of nx in this repo (the private repo this is failing on doesn't use nx), but for some reason, a .nx/ folder is being added when I use yarn auto shipit -vv on our master branch, which runs the all-contributors plugin. As far as I can tell, it's not coming from our end, because we don't use nx AND we run git reset --hard right before calling auto.

Re: this discussion, when working with nx >= 17, the .nx/ folder has been moved from node_modules/.cache to the workspace root. This is causing changedFiles in the code below to be true, which makes the plugin think that the README and .all-contributorsrc have been updated. The plugin tries to commit these files and errors out because those files actually have not changed.

https://github.com/intuit/auto/blob/335fadb33fc1b661faa2a82a1d992b0e81036a74/plugins/all-contributors/src/index.ts#L360-L366

Here is the error shown with `-vv` ``` The following paths are ignored by one of your .gitignore files: fastlane/README.md hint: Use -f if you really want to add them. hint: Turn this message off by running hint: "git config advice.addIgnoredFile false" fatal: pathspec '**/.all-contributorsrc' did not match any files On branch master Untracked files: (use "git add ..." to include in what will be committed) .nx/ nothing added to commit but untracked files present (use "git add" to track) Error: Running command 'git' with args [commit, --no-verify, -m, "Update contributors [skip ci]"] failed On branch master Untracked files: (use "git add ..." to include in what will be committed) .nx/ nothing added to commit but untracked files present (use "git add" to track) ```

To Reproduce

I will try to reproduce this with a small repo. TBD.

Expected behavior

I expect auto to:

  1. not crash my pipeline
  2. gracefully handle it when a user has not meet any new contribution criteria and shipit is called on master

Environment information:

Environment Information:

"auto" version: v11.0.1
"git"  version: v2.39.3 (Apple Git-145)
"node" version: v16.20.2
GHE version:    v3.10.8

Additional Context

ValentinH commented 4 months ago

Yes, same issue here. Thanks for the tip regarding the .gitignore 🎉

jackw commented 3 months ago

We don't use .nx/ in the repo this issue was discovered on, so not sure where it's coming from

The most likely candidate is that it's coming from Lernas dependencies.

I was able to workaround this on our pipeline by adding .nx/ to our .gitignore.

I think this is probably the best course of action all round as that directory is considered temporary for containing local cache data for nx. Another option would be to try setting the lerna.json property useNx: false and see if it prevents creation of the directory.

hipstersmoothie commented 2 months ago

Not sure there is anything actionable here for auto?