GitHub Actions Efficiency
Audit GitHub Actions workflow efficiency without weakening required validation. Focus on
runner time, wasted runs, broad triggers, and the fastest fixes that actually hold up under
review.
When to Use
- CI minutes are growing faster than the repository's actual change volume
- Workflows run too often for docs-only, workflow-only, or narrow-scope changes
- You need to optimize caches, concurrency, trigger scope, or matrix breadth
- A repository is onboarding GitHub Actions and needs a lean baseline first
- A team wants a before/after efficiency report grounded in real workflow evidence
When NOT to Use
| Instead of github-actions-efficiency |
Use |
| Debugging one failed workflow run |
actions-debugging |
| Reviewing Actions security risks |
gha-security-review |
| Auditing model or token spend across AI workflows |
cost-audit |
Prerequisites
- Access to
.github/workflows/
gh CLI access if you want live run data
- Understanding of which checks are mandatory for release, shared libraries, or migrations
Load Only What You Need
If no workflows exist yet, start with actions.md and define a minimal baseline before trying
to optimize.
If gh CLI access is unavailable, fall back to static analysis of workflow files and make the
scope explicit: Static-only analysis (not confirmed with live runs).
Core Workflow
1. Measure first
rg -n "on:|concurrency:|paths:|paths-ignore:|strategy:|matrix:|cache:" .github/workflows
gh run list --limit 10
$runId = gh run list --limit 1 --json databaseId --jq ".[0].databaseId"
gh run view $runId --log-failed
Look for:
- missing dependency caches
- missing
concurrency cancellation
- over-broad triggers
- duplicate workflow coverage across files or jobs
- expensive jobs that run on every change regardless of scope
2. Apply guardrails
Check each proposed fix against these rules before recommending it:
- Do not hide required validation for release, schema, migration, or shared-library safety.
- Do not reduce parallelism without justification; only accept a slower critical path when the
cost trade-off is explicit and still acceptable.
- Preserve only documented matrix legs; drop unsupported versions or platforms first.
- Keep write-back jobs opt-in; formatter or bot jobs should usually use labels, manual
dispatch, or another explicit trigger.
- Split repo-editable YAML changes from org-level or account-level settings.
3. Select the top 3 fixes
Rank the surviving candidates by expected daily CI minutes saved:
- add dependency caching with lockfile-based keys
- add or correct
concurrency cancellation
- remove duplicate workflow coverage before merging jobs
- narrow workflow or job triggers safely
- reduce matrix breadth to match risk and event type
- parallelize independent jobs on the critical path
Keep only changes supported by audit evidence and guardrails. Return up to three.
4. Verify
- If live GitHub access is available, validate concurrency cancellation and path gating with a
test change on a non-protected branch.
- If live validation is not possible, say so explicitly.
- Treat surprising live behavior as a real workflow bug even when the YAML looks correct.
Required Output
- Waste sources - top cost or latency drivers from the audit
- Proposed fixes - up to 3 recommendations with supporting evidence
- Validation - what was proven live, what stayed static-only, and what risk remains
- Impact - expected savings versus measured savings; separate PR wall-clock time from total runner time
Tips
- Measure before editing YAML; the first fix should be evidence-backed, not stylistic
- Prefer low-risk waste first: caches, concurrency, and redundant trigger scope
- Separate "fewer minutes billed" from "faster feedback for developers"
- Keep follow-up reviews short and ranked by value, not as a giant wishlist
See Also
1---2name: github-actions-efficiency3description: Use when auditing GitHub Actions workflows for efficiency — reducing CI minutes, cutting costs, eliminating redundant runs, or optimizing caching and concurrency.4---56# GitHub Actions Efficiency78Audit GitHub Actions workflow efficiency without weakening required validation. Focus on9runner time, wasted runs, broad triggers, and the fastest fixes that actually hold up under10review.1112## When to Use1314- CI minutes are growing faster than the repository's actual change volume15- Workflows run too often for docs-only, workflow-only, or narrow-scope changes16- You need to optimize caches, concurrency, trigger scope, or matrix breadth17- A repository is onboarding GitHub Actions and needs a lean baseline first18- A team wants a before/after efficiency report grounded in real workflow evidence1920## When NOT to Use2122| Instead of github-actions-efficiency | Use |23|--------------------------------------|-----|24| Debugging one failed workflow run | `actions-debugging` |25| Reviewing Actions security risks | `gha-security-review` |26| Auditing model or token spend across AI workflows | `cost-audit` |2728## Prerequisites2930- Access to `.github/workflows/`31- `gh` CLI access if you want live run data32- Understanding of which checks are mandatory for release, shared libraries, or migrations3334## Load Only What You Need3536- [`../../../references/github-actions-efficiency/actions.md`](../../../references/github-actions-efficiency/actions.md) - audit order, trigger scoping, matrix reduction, and live validation guidance37- [`../../../references/github-actions-efficiency/reporting.md`](../../../references/github-actions-efficiency/reporting.md) - before/after reporting and follow-up review passes38- [`../../../references/github-actions-efficiency/patterns.md`](../../../references/github-actions-efficiency/patterns.md) - concrete YAML examples when inline guidance is not enough39- [`../../../references/github-actions-efficiency/review-rubric.md`](../../../references/github-actions-efficiency/review-rubric.md) - review rubric for completed efficiency changes4041If no workflows exist yet, start with `actions.md` and define a minimal baseline before trying42to optimize.4344If `gh` CLI access is unavailable, fall back to static analysis of workflow files and make the45scope explicit: **Static-only analysis** (not confirmed with live runs).4647## Core Workflow4849### 1. Measure first5051```powershell52rg -n "on:|concurrency:|paths:|paths-ignore:|strategy:|matrix:|cache:" .github/workflows53gh run list --limit 1054$runId = gh run list --limit 1 --json databaseId --jq ".[0].databaseId"55gh run view $runId --log-failed56```5758Look for:5960- missing dependency caches61- missing `concurrency` cancellation62- over-broad triggers63- duplicate workflow coverage across files or jobs64- expensive jobs that run on every change regardless of scope6566### 2. Apply guardrails6768Check each proposed fix against these rules before recommending it:69701. Do not hide required validation for release, schema, migration, or shared-library safety.712. Do not reduce parallelism without justification; only accept a slower critical path when the72 cost trade-off is explicit and still acceptable.733. Preserve only documented matrix legs; drop unsupported versions or platforms first.744. Keep write-back jobs opt-in; formatter or bot jobs should usually use labels, manual75 dispatch, or another explicit trigger.765. Split repo-editable YAML changes from org-level or account-level settings.7778### 3. Select the top 3 fixes7980Rank the surviving candidates by expected daily CI minutes saved:81821. add dependency caching with lockfile-based keys832. add or correct `concurrency` cancellation843. remove duplicate workflow coverage before merging jobs854. narrow workflow or job triggers safely865. reduce matrix breadth to match risk and event type876. parallelize independent jobs on the critical path8889Keep only changes supported by audit evidence and guardrails. Return up to three.9091### 4. Verify9293- If live GitHub access is available, validate concurrency cancellation and path gating with a94 test change on a non-protected branch.95- If live validation is not possible, say so explicitly.96- Treat surprising live behavior as a real workflow bug even when the YAML looks correct.9798## Required Output991001. **Waste sources** - top cost or latency drivers from the audit1012. **Proposed fixes** - up to 3 recommendations with supporting evidence1023. **Validation** - what was proven live, what stayed static-only, and what risk remains1034. **Impact** - expected savings versus measured savings; separate PR wall-clock time from total runner time104105## Tips106107- Measure before editing YAML; the first fix should be evidence-backed, not stylistic108- Prefer low-risk waste first: caches, concurrency, and redundant trigger scope109- Separate "fewer minutes billed" from "faster feedback for developers"110- Keep follow-up reviews short and ranked by value, not as a giant wishlist111112## See Also113114- [`actions-debugging`](../../copilot-exclusive/actions-debugging/SKILL.md) - investigate failed workflow runs and job logs115- [`gha-security-review`](../../security/gha-security-review/SKILL.md) - review GitHub Actions workflows for exploitable security issues116- [`cost-audit`](../cost-audit/SKILL.md) - compare broader AI cost patterns beyond CI runner spend