Unnecessary full git history checkout

Rule ID

unnecessary_full_checkout

Category

performance

Severity

low

fetch-depth: 0 is used but no git history analysis (changelog generation, git log, blame) is present in the workflow.

Detection

pattern_matching — Regex or keyword matching on string field values.

Examples

Non-compliant:

jobs:
  build:
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - run: npm ci && npm run build

Compliant:

jobs:
  build:
    steps:
      - uses: actions/checkout@v4
      - run: npm ci && npm run build

Fix: Remove fetch-depth: 0 unless the job needs full git history (changelog generation, git log, semantic-release). Shallow clones are significantly faster.