-
-
Notifications
You must be signed in to change notification settings - Fork 218
Description
When using options.affectedFiles, moon filters changed files against the task's inputs and passes matching files as arguments (or via the MOON_AFFECTED_FILES env var) to the command. The problem is that inputs serves a dual purpose: cache invalidation and affected file filtering. This means config files like .eslintrc.json or tsconfig.json that are listed in inputs for cache invalidation also get passed as command arguments — causing tools like ESLint to try to lint those config files.
For example, given this task:
tasks:
lint:
command: eslint
inputs:
- 'src/**/*.ts'
- '.eslintrc.json'
options:
affectedFiles: argsIf .eslintrc.json changes, it correctly invalidates the cache, but it also gets passed to ESLint as eslint .eslintrc.json, which is not the intended behavior.
It would be great to have a way to control which affected files actually get passed to the command, independent of cache invalidation inputs. Something like a glob filter on affectedFiles:
tasks:
lint:
command: eslint
inputs:
- 'src/**/*.ts'
- '.eslintrc.json'
options:
affectedFiles:
args: true
filter: 'src/**/*.ts'This way, inputs continues to define what invalidates the cache, while affectedFiles.filter controls which of those files actually get forwarded to the command. Only files matching the filter pattern would be passed as arguments.