Skip to content

CICD-104 · Skip a build after an exact cache hit ​

Encyclopedia · Workflow reuse and caching · All snippets

Previous · CICD-103 · Next · CICD-105

1. Where it fits ​

  • Placement .github/workflows/ci.yml, under a job's steps.
  • Prerequisites trusted checkout and cache/artifact support verified on the chosen Actions runner.
  • Platforms github-actions, gitea-actions.

2. Copy the snippet ​

yaml
if: steps.cache.outputs.cache-hit != 'true'
run: npm run generate

3. How it works ​

The cache action exposes exact-hit state as a string. Only a literal true skips this build, so fallback restores still trigger regeneration.

4. Verify the result ​

Use a cache for fully keyed generated output and validate restored output independently.

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