Skip to content

CICD-016 · Check out full history ​

Encyclopedia · Jobs, steps and runner selection · All snippets

Previous · CICD-015 · Next · CICD-017

1. Where it fits ​

  • Placement .github/workflows/ci.yml, under a job's steps.
  • Prerequisites workflow containing the named example jobs or steps.
  • Platforms github-actions, gitea-actions.

2. Copy the snippet ​

yaml
uses: actions/checkout@v4
with:
  fetch-depth: 0

3. How it works ​

fetch-depth 0 instructs checkout to fetch full history, including tags and branches. Diff and release jobs can then resolve ancestry that a shallow clone may omit.

4. Verify the result ​

Use merge-base on fetched refs rather than assuming an ancestor exists in a shallow clone.

Validation syntax-validated (YAML parse). Status definitions.