wearerequired/lint-action

Only lint modified files

Open

#47 opened on May 11, 2020

 (13 comments) (3 reactions) (0 assignees)JavaScript (145 forks)auto 404
blockedenhancementhelp wanted

Repository metrics

Stars
 (609 stars)
PR merge metrics
 (PR metrics pending)

Description

I was going through the codebase to see how feasible to add this feature because we currently need it.

Suggestion

I was thinking of adding an extra param [linter]_only_changed_files: boolean (we can decide on the best name to go with).

Then checking doing a quick diff of the current branch with

FILES = git diff --diff-filter=$filter --name-only $baseBranch | grep -E $extensions

where:

I see you already swap branch for hasFork here: https://github.com/samuelmeuli/lint-action/blob/a820202c34156c11c68a7c534178ac66e12758b9/src/git.js#L22

We just need to do the same thing with the base repository:

  • check if it's a fork, if so fetch it and add it to maybe base-fork remote locally
  • else if it's not a fork, we don't need to fetch
  • with the above steps, we can easily infer the base remote and branch name

Don't know if this is what you want to support @samuelmeuli else I can spin up a PR for this.

@samuelmeuli wdyt?

Contributor guide