Skip to content

ci: add path filters - #1871

Merged
webpro merged 4 commits into
webpro-nl:mainfrom
trueberryless:ci/path-filters
Jul 7, 2026
Merged

ci: add path filters#1871
webpro merged 4 commits into
webpro-nl:mainfrom
trueberryless:ci/path-filters

Conversation

@trueberryless

Copy link
Copy Markdown
Contributor

Description

This PR adds path filters to all GitHub workflows to exit CI early when run is not necessary.

Here is some data of past runs from the last month and how much runs could have been skipped:

Workflow Runs sampled Would skip Skip % Avg dur Min saved
ci.yml 84 13 15.5 % 3.5 min 50
ci-bun.yml 84 13 15.5 % 7.5 min 44
ci-legacy-5.0.4.yml 83 14 16.9 % 12.5 min 184
integration.yml 84 13 15.5 % 3.1 min 38
Total/Avg 335 53 15.8 % 6.7 min ~316 min / month

@pkg-pr-new

pkg-pr-new Bot commented Jul 6, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/knip@1871
npm i https://pkg.pr.new/@knip/language-server@1871
npm i https://pkg.pr.new/@knip/mcp@1871

commit: 11353c7

@webpro

webpro commented Jul 6, 2026

Copy link
Copy Markdown
Member

This is great! Path filters LGTM. What is the difference with setting e.g. on.*.paths at the root level of a workflow config?

@trueberryless

Copy link
Copy Markdown
Contributor Author

This is great! Path filters LGTM. What is the difference with setting e.g. on.*.paths at the root level of a workflow config?

I knew/hoped you would ask that 😅

The difference is that with on.*.paths the workflow is not even triggered whereas here it reports a successful status. This is important if you add a branch ruleset which has those workflows marked as required before merging. Doing it with on.*.paths would lead to PRs, where the CI should not trigger, hanging because the requirements are not met.

Does that make sense?

@webpro

webpro commented Jul 7, 2026

Copy link
Copy Markdown
Member

Thanks for clearing that up! The "if" is doing a lot of work here. Feels like we don't yet have any trait that warrant pulling in the extra complexity (actions + config). How about starting out with on.*.paths and expand on this idea as we go?

@trueberryless

Copy link
Copy Markdown
Contributor Author

Thanks for clearing that up! The "if" is doing a lot of work here. Feels like we don't yet have any trait that warrant pulling in the extra complexity (actions + config). How about starting out with on.*.paths and expand on this idea as we go?

Good to know. I'll adapt it for now and if you enable auto-merge in the future, we just need to remember to change that 👍

@webpro
webpro merged commit 4249935 into webpro-nl:main Jul 7, 2026
30 checks passed
@webpro

webpro commented Jul 7, 2026

Copy link
Copy Markdown
Member

Thank you! 🙏 This looks great.

@trueberryless
trueberryless deleted the ci/path-filters branch July 7, 2026 11:11
@webpro

webpro commented Jul 10, 2026

Copy link
Copy Markdown
Member

🚀 This pull request is included in v6.26.0. See Release 6.26.0 for release notes.

Using Knip in a commercial project? Please consider becoming a sponsor.

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.

2 participants