How do you get the list of files changed in a pipeline run, reliably?
I want to run expensive steps only when the relevant part of the repository changed, build the frontend when the frontend changed, run the migration checks when migrations changed.
Diffing against the previous commit works for a simple push and gives the wrong answer for a merge, a first run on a new branch, or a re-run. I have a script that mostly works and fails confusingly a few times a month.
What is the correct way to determine what changed?
@pipeline_pars · 4w ago
The reason your script fails intermittently is that "what changed" has no single answer - it depends on what the run is for, and the runs are not all the same kind.
The two questions people conflate:
Almost everybody wants the second and writes the first. That is the bug.
Get the merge base explicitly rather than assuming a parent:
Reply
Report