actions / actions/checkout

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

Open
#862 7 comments 53 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
8.9k
Forks
2.8k
PR merge metrics
No merged PRs in 30d

Description

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/

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the checkout action's existing clean option and the code that invokes git clean. Add support for the proposed clean-exclude input, then verify that its value is passed to git clean so paths such as /node_modules/ are preserved while other untracked files are cleaned.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
ci-cd
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.