Instiq
Chapter 5 · Secure and Optimize Automation·v1.0.0·Updated 6/14/2026·~14 min

What's changed: New GH-200 Chapter 5 (security best practices = script-injection mitigation, GITHUB_TOKEN least privilege vs PAT, OIDC cloud federation, SHA pinning/trustworthy actions/usage policies, attestations/provenance (SLSA), environment approval gates; performance/cost optimization = actions/cache, retention (REST API), matrix size/max-parallel, concurrency+cancel-in-progress, paths/branches filters, if conditions, runner sizing)

5.2Optimizing Performance and Cost

Key points

Understand efficiency via caching and artifact retention, applying retention policies via REST APIs, and strategies for scaling and cost-optimizing workflows—concurrency, matrix size, concurrency groups, runner selection, conditionals, and path/branch filters.

GitHub Actions usage is billed by execution minutes and storage (artifacts/cache). GH-200 tests optimizing for faster and cheaper runs without sacrificing results. The levers fall into "reduce waste (avoid unneeded runs/re-downloads)" and "tune parallelism and retention."

5.2.1Caching and retention

Caching (actions/cache)—avoiding dependency re-fetches—is the most effective speed-up (Chapter 1). Artifacts and logs have a retention period; keeping them longer increases storage billing—review defaults and shorten via retention-days at upload to cut cost. These retention policies are also applicable/inspectable via the REST API, enabling org-wide auto-deletion of stale data. Note caches have free-tier/size limits and old caches are evicted automatically.

Continue reading — free sign-up

You're reading the free preview. Sign up free to read this section in full, plus every chapter (including 4+) and all questions.