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

Add a 'clean-exclude' option (to avoid cleaning node_modules) #862

Open
dapirian opened this issue Jul 22, 2022 · 5 comments
Open

Add a 'clean-exclude' option (to avoid cleaning node_modules) #862

dapirian opened this issue Jul 22, 2022 · 5 comments

Comments

@dapirian
Copy link

Currently, the checkout action will delete node_modules with git clean -ffdx. Since I use (mostly) persistent self-hosted runners, it's extremely inefficient to constantly be deleting and recreating node_modules. It takes about a minute just to do the deletion in git clean and another 3 minutes to repopulate node_modules after that.

It would be much much faster to be able to pass the exclude flag to clean, for example:

git clean -ffdxe '/node_modules/'

# Or, more explicit...
git clean -ffdx --exclude='/node_modules/'

This could just be another argument to the action, so usage might be...

- name: Checkout
   uses: actions/checkout@v3
   with:
     clean-exclude: /node_modules/
@dapirian dapirian changed the title Add a 'clean-exclude' option Add a 'clean-exclude' option (to avoid cleaning node_modules) Jul 22, 2022
@DarrinHidef
Copy link

DarrinHidef commented Nov 15, 2022

As further clarification, it is handy to have the git clean run, so you know the workspace matches the repo. But for some builds, we don't have control of where the build artifacts get dropped (e.g. with Unity, it produces a Library directory at the top level of the workspace). And those can be expensive to reproduce each time. So we'd like to have their deletion be controlled with a flag, like this. So we can sometimes do clean builds, and sometimes not.

Use of a cache to handle that can be expensive, since the artifacts are so large.

@diroussel
Copy link

This can be easily done in gitlab by setting GIT_CLEAN_FLAGS to override the args passed to git clean. But in github actions, the work around is very tedious. I have to set clean: false on every checkout of every job, and then add another step to manually do the correct git clean. But that doesn't work without adding a 'safe.directory'. It would be so much easier if a custom clean-exclude attribute, or env var was supported.

One way to simplify that I tried was to create a bash script action (we have others in the same repo, in the .github folder) that does the checkout and the git setup, and the clean, but all in one place. But this doesn't work, as you can't reference other actions in the same repo until you've done the checkout. So either you need a separate repo, or to do a lot of duplication.

@AdarshHatkar
Copy link

any update?

@MostefaKamalLala
Copy link

@dapirian did you come up with a solution?

@taco-chen
Copy link

Looking forward to have this feature!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants