Skip to content

fix(research): read GitHub Actions path filters from the workflow's on: triggers - #182

Merged
adityankale190895 merged 2 commits into
DiffCI:mainfrom
FredApps:fix/workflow-path-filters
Nov 18, 2026
Merged

adityankale190895 merged 2 commits into
DiffCI:mainfrom
FredApps:fix/workflow-path-filters

Conversation

@FredApps

Copy link
Copy Markdown
Contributor

Fixes #177

What changed

parseWorkflow (src/research/baseline/workflow-parser.ts) looked for paths / paths-ignore on each job (job.paths, job.on.paths). GitHub Actions only has them under the workflow's triggers, so pathGlobs was undefined for every real workflow, and buildGenericTaskRegistry always used the category defaults.

The new workflowPathFilters reads on.<push|pull_request|pull_request_target>.paths and paths-ignore. It stays conservative:

Regression tests

tests/research/baseline/workflow-parser.test.ts adds five tests: a pull_request.paths filter, the union over push and pull_request, paths-ignore, the no-filter cases (unfiltered trigger, list or string on:, negation, non-plain glob, dispatch only), and the registry using the filter as the task's inputPatterns. Four of them fail on main. The no-filter test passes before and after, as intended.

Validation

npm run typecheck, npm test and npm run audit:boundary pass. tests/analyze.test.ts and tests/planner/path-baseline.test.ts are unchanged and pass.

Not covered

pathIgnoreGlobs is now filled in, but buildGenericTaskRegistry still doesn't use it. Wiring it in is a planner behavior change and is left out of this fix.

…n: triggers

parseWorkflow looked for paths and paths-ignore on each job, where
GitHub never puts them, so pathGlobs was undefined for every real
workflow. Read on.<push|pull_request|pull_request_target>.paths, and
only when every such trigger is filtered and the patterns are plain.

Fixes DiffCI#177

Signed-off-by: FredApps <[email protected]>
GitHub reads '**', '**.js' or 'src**' as crossing directories, but the
planner's matcher turns a ** that is not next to a slash into *, so the task
would only match top-level files and be marked a skip candidate for changes
GitHub runs it for. Leave the filter unset for those patterns.

Signed-off-by: FredApps <[email protected]>

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cross-review at 9ee8835.

Checked:

  • The trigger-level reading matches GitHub: a filter is used only when every push or pull_request trigger has one, and negated or non-plain patterns are dropped.
  • The four new tests fail without the change.
  • analyzeCheckout uses DefaultCIPlanner, so these globs are matched by src/planner/planner.ts.

Fixed:

  • PLAIN_GLOB accepted '**', '**.js' and 'src**'. GitHub lets those cross directories, but the planner's matcher on main turns a ** that isn't next to a slash into *. A paths: ['**.js'] workflow therefore only matched top-level files, and its task became SKIP_CANDIDATE for src/a.js changes that GitHub runs it for.
  • 9ee8835 leaves the filter unset unless every ** is a whole path segment. A test covers '**', '**.js', 'src**', '{**,docs/*}' and 'a/***', and checks that **/*.ts, api/**, a/**/b and {api,web}/** are still kept.

All Actions jobs are green on 9ee8835. The external "DiffCI change impact" app check was still in progress when I posted this.

Open:

  • Once #174 lands, the planner reads these ** forms the GitHub way and this guard could be relaxed.
  • pathIgnoreGlobs is still unused, as noted.

FredApps added a commit to FredApps/core that referenced this pull request Nov 18, 2026
…test so it merges cleanly with DiffCI#182

No change to the tests themselves. DiffCI#182 appends its path-filter tests at the end of the same describe block.

Signed-off-by: FredApps <[email protected]>
@FredApps
FredApps marked this pull request as ready for review November 18, 2026 00:56
adityankale190895 pushed a commit that referenced this pull request Nov 18, 2026
…es diffci plan (#171)

* fix(research): an empty or comment-only workflow file no longer crashes diffci plan

YAML.parse returns null for such a file, and parseWorkflow read .name
from it, so analyzeCheckout threw for the whole repository.

Fixes #168

Signed-off-by: FredApps <[email protected]>

* test(research): place the empty-file cases before the malformed-file test so it merges cleanly with #182

No change to the tests themselves. #182 appends its path-filter tests at the end of the same describe block.

Signed-off-by: FredApps <[email protected]>

---------

Signed-off-by: FredApps <[email protected]>
@adityankale190895
adityankale190895 merged commit fe586bc into DiffCI:main Nov 18, 2026
12 of 13 checks passed
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

Successfully merging this pull request may close these issues.

Workflow parser never reads GitHub Actions path filters (looks for paths on the job, not under on:)

2 participants