How does `actions/checkout` behave regarding history and submodules?
IntermediateConceptGitHub Actions
Answer
By default it does a shallow clone (fetch-depth: 1) of the triggering commit, which is fast but breaks things that need history: git describe, changelog generation, SonarQube blame, or merge-base diffs. Set fetch-depth: 0 for full history, submodules: recursive for submodules, and persist-credentials: false to avoid leaving the token in .git/config when later steps run untrusted code.
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
More on GitHub Actions
What are workflows, jobs, steps and actions in GitHub Actions?BeginnerWhat events can trigger a workflow?BeginnerWhat is the difference between `pull_request` and `pull_request_target`?AdvancedWhat is a runner, and how do GitHub-hosted and self-hosted runners differ?BeginnerHow do you pass data between steps and between jobs?IntermediateHow does a build matrix work?Intermediate