DEV Community

Discussion on: Get changed files in github actions

Collapse
 
parasense profile image
parasense

To elaborate on Anton Orlov's answer regarding fetch-depth.
To have git diff the current HEAD (depth:1) against the previous commit (depth:2), then one needs to have at least fetch-depth: 2, and if one wants to diff against deeper history one must set the depth accordingly. Many git work flows only fetch a depth:1 as an optimization, to avoid expensive IO copying entire repos when only the single commit is needed.