Install
$ agentstack add skill-imtiazrayhan-agentscamp-library-github-actions-optimizer ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
A workflow that takes 22 minutes and costs you a fortune in minutes is rarely slow for one reason — it's usually re-downloading dependencies every run, running serially what could run in parallel, and building branches no one is waiting on. And the same file is often a supply-chain liability: a third-party action pinned to @v3 can be repointed under you, and a write-all token plus pull_request_target is one malicious fork PR away from leaking secrets. This skill measures before it touches anything, then ships fixes ordered by payoff — biggest time or security win first — as concrete YAML diffs.
When to use this skill
- CI wall-clock is the bottleneck on every PR, runs queue behind each other, or the monthly Actions bill is climbing.
- A job re-installs the whole dependency tree or rebuilds from scratch on every run, with no cache or a cache that never hits.
- The workflow runs on
pull_request/pull_request_targetfrom forks and you haven't audited what secrets and permissions are exposed. - You inherited a workflow that pins actions to floating tags (
@v4,@main) and grants the default broadGITHUB_TOKEN.
When NOT to use this skill
- The slowness is in your test suite itself (flaky retries, an N+1 in integration tests) rather than the CI plumbing — fix the tests; faster runners won't save a 9-minute test that should take 90 seconds.
- You need a workflow authored from scratch for a new stack — that's scaffolding work; this skill optimizes and hardens an existing
.github/workflows/*.yml.
Instructions
- Inventory the workflows before changing one. Glob
.github/workflows/*.{yml,yaml}and read each. For every workflow note its triggers (on:), its jobs and theirneeds:graph, the runner labels (ubuntu-latestvs a larger/self-hosted runner — larger runners bill at a multiple), and the matrix dimensions. This is the map; you optimize against it, not against guesses. - Profile where time actually goes — don't optimize from intuition. Pull recent run timings with the CLI:
gh run list --workflow -L 20 --json databaseId,conclusion,createdAt,updatedAtfor wall-clock per run, thengh run view --json jobsto get per-job durations. The serial critical path isneeds:-chained job durations summed; a 4-minute lint that gates a 12-minute test set adds 4 minutes to everyone. Rank jobs and steps by total billed minutes (duration × runs/day × runner multiplier). Fix the top one first. - Add caching with a content-based key — or don't bother. Cache the package manager's store, not
node_modules/.venv(restoring a half-built tree is worse than a clean install). Key on a hash of the lockfile so the cache invalidates exactly when deps change:key: ${{ runner.os }}-deps-${{ hashFiles('**/package-lock.json') }}with arestore-keys: ${{ runner.os }}-deps-prefix fallback for partial hits. For language setup actions (actions/setup-node,setup-python,setup-go), prefer their built-incache:input — it keys on the lockfile for you and handles the path. Confirm a hit after: the run log printsCache restored from key(orCache not found). A cache that never hits is pure overhead — it uploads on every run and restores nothing. - Parallelize the critical path. Convert serial variants (Node 18/20/22, OS targets, test shards) into a
strategy.matrixso they run concurrently instead of in sequence. Split a single monster test job into shards withmatrix+ a test-splitting flag (--shard ${{ matrix.shard }}/${{ matrix.total }}). Drop unnecessaryneeds:edges — only gate a job on what it truly consumes; lint and unit tests rarely need to wait on each other. Setfail-fast: falseonly when you want all matrix legs to report; leave ittrue(default) to abort the matrix the moment one leg fails and stop burning minutes. - Cancel superseded runs with
concurrency. Add a top-levelconcurrencygroup keyed on the ref so a new push cancels the in-flight run for that branch instead of running both:concurrency: { group: ${{ github.workflow }}-${{ github.ref }}, cancel-in-progress: true }. This alone can halve minutes on an active branch. Do NOT setcancel-in-progress: trueon deploy/release workflows — cancelling a half-finished deploy mid-flight can leave the environment in a broken state. - Skip work that can't be affected. Add
paths:/paths-ignore:filters so a docs-only change doesn't trigger the full build matrix, andbranches:filters so feature pushes don't run release jobs. For required status checks, use a path filter plus a tiny "always-green" companion job (orpaths-filteraction with a downstreamif:) so the required check still reports success on skipped paths — a hardpaths:skip leaves a required check pending forever and blocks merges. - Pin third-party actions to a full commit SHA. Replace every
uses: owner/action@v4(and especially@main) for third-party actions with the full 40-char commit SHA, keeping the version in a trailing comment:uses: owner/action@a1b2c3...def # v4.1.2. A floating tag is mutable — the owner (or an attacker who compromises them) can repoint it at code that exfiltrates your secrets, and your pinned-to-tag workflow will silently run it. First-partyactions/*are lower risk but pinning them too is the consistent posture. Usegh api repos///git/ref/tags/to resolve a tag to its SHA. - Set least-privilege
permissionsonGITHUB_TOKEN. Add a top-levelpermissions: { contents: read }to default everything to read, then grant exactly what each job needs at the job level (packages: writeto publish,pull-requests: writeto comment,id-token: writefor OIDC). The repo default is oftenread-writeon everything; a token that can push tocontentsis a token a compromised dependency can use to push to your branches. - Quarantine secrets from untrusted fork PRs. Understand the split:
pull_requestfrom a fork runs with a read-only token and no repo secrets — safe but limited.pull_request_targetruns in the context of the base repo with secrets and a writable token, while checking out the fork's code — this is the dangerous one. Nevercheckoutand then build/run a fork's code underpull_request_target; that hands an attacker your secrets via a malicious build script or workflow. If you need a label-gated privileged step, split it into a separateworkflow_run/manually-approved job that operates only on trusted artifacts, never on raw fork code.
> [!WARNING] > An unkeyed or over-broad cache rots silently. If the key isn't tied to the lockfile, the cache never invalidates — CI keeps restoring stale dependencies, masking lockfile changes and producing "works in CI, broken locally" drift. If the key is too unique (includes github.sha), it never hits and you pay the upload cost every run for nothing. Verify "Cache restored from key" appears in real run logs before calling caching done.
> [!CAUTION] > A third-party action pinned to a moving tag (@v4, @main) is remote code you don't control, running with your token and secrets. Tag mutation is the documented supply-chain attack (see the tj-actions/changed-files incident). Pin to a full commit SHA, and review the diff before bumping the SHA — never auto-update action SHAs without reading what changed.
> [!CAUTION] > Secrets must never reach untrusted fork code. pull_request_target + checking out the PR head + running its scripts = secret exfiltration. Default to pull_request for fork CI, keep secrets out of those runs, and gate any privileged automation behind manual approval or a separate trusted workflow.
Output
A prioritized remediation plan ordered by payoff — each item tagged TIME or SECURITY, with the measured cost it addresses (e.g. "SECURITY: 3 actions on floating tags"; "TIME: deps re-installed every run, ~90s × 40 runs/day") — followed by the concrete YAML diffs to apply, smallest-blast-radius wins first. Each diff is a minimal, reviewable change to a specific workflow file (added concurrency block, a cache step with its key, a matrix rewrite, SHA pins with version comments, a permissions block). The skill proposes edits via Edit and uses Bash only for read-only gh/git profiling and tag-to-SHA resolution; it does not push, re-run, or alter pipeline behavior beyond the diffs you approve.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: imtiazrayhan
- Source: imtiazrayhan/agentscamp-library
- License: MIT
- Homepage: https://agentscamp.com
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.