CI на GitHub Actions
Пишет и чинит workflow GitHub Actions: триггеры, кеш, матрицы, concurrency, минимальные permissions, секреты, SHA-пины и разбор логов. Используйте при добавлении, правке или отладке CI.
github-actions-ciУстановка
Выполните одну команду — она сохранит SKILL.md в папку скиллов агента. Перезапустите агента, и он подхватит скилл сам.
mkdir -p ~/.claude/skills/github-actions-ci && curl -fsSL https://anymodel.org/en/skills/devops/github-actions-ci/SKILL.md -o ~/.claude/skills/github-actions-ci/SKILL.md
mkdir -p ~/.agents/skills/github-actions-ci && curl -fsSL https://anymodel.org/en/skills/devops/github-actions-ci/SKILL.md -o ~/.agents/skills/github-actions-ci/SKILL.md
New-Item -ItemType Directory -Force "$HOME\.claude\skills\github-actions-ci" | Out-Null; Invoke-WebRequest https://anymodel.org/en/skills/devops/github-actions-ci/SKILL.md -UseBasicParsing -OutFile "$HOME\.claude\skills\github-actions-ci\SKILL.md"
New-Item -ItemType Directory -Force "$HOME\.agents\skills\github-actions-ci" | Out-Null; Invoke-WebRequest https://anymodel.org/en/skills/devops/github-actions-ci/SKILL.md -UseBasicParsing -OutFile "$HOME\.agents\skills\github-actions-ci\SKILL.md"
Другой агент: сохраните файл в его папку скиллов или дайте ему ссылку на файл: https://anymodel.org/en/skills/devops/github-actions-ci/SKILL.md
SKILL.md
GitHub Actions CI
Create or repair workflows in .github/workflows/. Keep them fast, deterministic and least-privilege. Read the existing workflows and the project's build/test commands first; reuse the commands developers already run locally.
Workflow for a new or changed pipeline
- Find the real commands:
package.jsonscripts,Makefile,pyproject.toml,tox.ini. The CI should call the same commands. - Choose triggers deliberately (see below).
- Write the smallest workflow that builds and tests. Add caching, matrix and extras only when they pay off.
- Validate the YAML (
actionlintif installed, otherwise a YAML parser) before pushing. - Do not push or open a PR without the user's go-ahead; report what to look at in the first run.
Skeleton
name: ci
on:
pull_request:
push:
branches: [main]
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@<full-commit-sha> # v4.x.x
- uses: actions/setup-node@<full-commit-sha> # v4.x.x
with:
node-version-file: .nvmrc
cache: npm
- run: npm ci
- run: npm test
Look up the current commit SHA of each action's release tag; never invent one.
Rules
Triggers
pull_requestfor checks on contributions;pushto the default branch for post-merge work;workflow_dispatchfor manual runs;schedulefor nightly jobs.- Use
paths:/paths-ignore:to skip unrelated changes, but remember required checks that are skipped can block merging. - Never use
pull_request_targetto run code from a fork. It runs with secrets and write access.
Permissions
- Set top-level
permissions: contents: readand widen per job only where needed (pull-requests: write,packages: write,id-token: write). - Prefer OIDC (
id-token: write) with a cloud role over long-lived cloud keys in secrets.
Pinning actions
- Pin third-party actions to a full commit SHA with the version in a trailing comment. Tags can be moved by the action's owner.
- First-party
actions/*may use a version tag if the team accepts that; say which policy you applied. - Enable Dependabot/Renovate for
github-actionsso pins get updated.
Caching
- Use the built-in
cache:of the setup actions (npm, pip, gradle, go) keyed on the lock file. - For custom caches use
actions/cachewith a key containinghashFiles('**/lockfile')and arestore-keysfallback. - Never cache secrets,
.envfiles or credentials.
Matrix
- Use
strategy.matrixfor language versions or OS only when the project supports them. Setfail-fast: falsewhen you want all results. - Keep the matrix small; every cell costs minutes.
Concurrency and cost
- Use a
concurrencygroup so new pushes cancel stale PR runs. Do not cancel deploy jobs on the default branch. - Set
timeout-minuteson every job to avoid six-hour hangs.
Secrets
- Reference secrets only through
${{ secrets.NAME }}inenv:of the step that needs them, not at workflow level. - Never
echoa secret or run withset -xaround it. Never pass secrets in command-line arguments when an env var works. - Secrets are not available to workflows from forks; design the check so it still passes without them or is skipped clearly.
- Untrusted input (
github.event.pull_request.title, branch names) must not be interpolated directly intorun:. Pass it throughenv:and quote it.
Debugging a failing run
gh run list --limit 5
gh run view <run-id> --log-failed
gh run view <run-id> --json jobs --jq '.jobs[] | select(.conclusion=="failure") | .name'
gh run rerun <run-id> --failed # only after the user agrees
- Read the first real error in the failed step, not the last line of the log.
- Decide: code bug, flaky test, environment difference (OS, Node/Python version, missing env var), cache poisoning, or permissions.
- Reproduce locally with the same command and versions when possible.
- For cache suspicion, change the cache key once and rerun rather than guessing.
Output format
Report: the workflow files changed, what each change does and why, how it was validated (linter, local run), and the risks (for example "requires repository setting X" or "pins need SHAs verified").
Pitfalls
- Do not add
continue-on-error: trueto hide a failure. - Do not disable or delete tests to make CI green.
- Do not grant
write-allpermissions to fix a 403; find the one permission needed. ubuntu-latestchanges over time; pin a version (ubuntu-24.04) if reproducibility matters.- YAML gotchas: unquoted
on, versions like3.10parsed as3.1; quote versions.
Source: AnyModel skills catalog · License: CC BY 4.0
Подключить через AnyModel API
Скилл работает на той модели, которую использует агент. Подключите Claude Code, Codex или Cursor к AnyModel и запускайте его на Claude, GPT, Gemini и других моделях по одному ключу — оплата за токены, без подписки.
AnyModel