Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
KVSRoyal opened this issue Apr 23, 2024 · 3 comments
Open
Labels
bug Something isn't working

Comments

@KVSRoyal
Copy link

KVSRoyal commented Apr 23, 2024

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.

const changedFiles = await execPromise("git", ["status", "--porcelain"]);
if (changedFiles) {
await execPromise("git", ["add", "README.md"]);
await execPromise("git", ["add", ".all-contributorsrc"]);
await on(execPromise("git", ["add", "**/README.md"]));
await on(execPromise("git", ["add", "**/.all-contributorsrc"]));

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 <file>..." 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 <file>..." 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

  • I was able to workaround this on our pipeline by adding .nx/ to our .gitignore.
  • We don't use .nx/ in the repo this issue was discovered on, so not sure where it's coming from
  • This issue is happening for master but not for other branches. I didn't test next
@KVSRoyal KVSRoyal added the bug Something isn't working label Apr 23, 2024
@ValentinH
Copy link
Contributor

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

@jackw
Copy link
Contributor

jackw commented Jun 13, 2024

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
Copy link
Collaborator

Not sure there is anything actionable here for auto?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants