Skip to content

Run only the pipeline jobs a change needs #128

Done
LeanMeanCleanApps/CleanLambdaFunction
#80

Description

@stphnwlsh

Every pull request runs the whole Build Pipeline, whatever it touches. A pull request that changed five skill files (CleanMinimalApi #102) still ran Build, Test, both Static Analysis jobs, Dependency Review and Container Scan, about seven and a half minutes of runner time to check Markdown. The pipeline should work out what a change touches and run only the jobs that can say something about it.

What runs for what

A change that touches Runs
src/, tests/, *.props, *.slnx, global.json, .editorconfig, Dockerfile, docker-compose.yml, .template.config/, and anything else not listed below Everything, as today
.github/workflows/ or .github/actions/ Everything, as today
Only what the package ships besides code: .agents/, AGENTS.md, CLAUDE.md, template/, docs/RUN.md, NUGET.md, LICENSE.md, icon.png Build (it packs the template), Test (it verifies the packed template), both Static Analysis jobs and Summary
Only repository documents: README.md, CONTRIBUTING.md, the community files, issue forms, the pull request template, and the CODEOWNERS, Dependabot, labeler and release note settings Both Static Analysis jobs and Summary

The scheduled maintenance and release runs, and manual runs, always run everything. Static Analysis scans the workflows and the C# on every run, because the code scanning rule on main expects CodeQL results for both.

Phase 1: Prove it on CleanMinimalApi

  • dorny/paths-filter is on the organisation's list of allowed actions
  • A first job uses dorny/paths-filter, pinned to a commit like the other third-party actions, to work out which of the groups above a pull request or push touches
  • Each job runs only when its group is touched, and reports as skipped otherwise
  • Confirm a skipped job satisfies its required check, including the two Static Analysis matrix checks, whose names only exist once the matrix expands
  • Confirm the code scanning rule on main lets a pull request merge when CodeQL only scanned the workflows (it doesn't: Give every repository a standard set of issue forms #108 failed the rule, so both scans now run on every pull request)
  • Summary shows a job that wasn't needed as "not needed", not as a failure, and still fails when a job that ran failed
  • Try four pull requests: code, a workflow, a skill, the README

Phase 2: Carry it to the other four

  • The same workflow change in MCP, GraphQL, Web API and Lambda Function
  • ci-pipeline skill says what runs for what

Not in scope: the starter ci.yml that ships to generated solutions stays as simple as it is.

Checks: the four trial pull requests run only the jobs in the table and can be merged, a scheduled run still runs everything, and Shared Layers Drift finds no differences.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions