{"data":{"slug":"discovered-dfcf443aa4cc3eb3c7dab634a8466b0d507ca0b7d7e03e55","title":"CI Pipelines for GitHub Actions","summary":"Set up and enforce GitHub Actions pipelines for typecheck, lint, test, security scan, build, and release. Includes branch protection rules, workflow templates, and best practices for CI configuration.","url":"https:\/\/skillshunter.net\/skills\/discovered-dfcf443aa4cc3eb3c7dab634a8466b0d507ca0b7d7e03e55","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/discovered-dfcf443aa4cc3eb3c7dab634a8466b0d507ca0b7d7e03e55","markdown_url":"https:\/\/skillshunter.net\/skills\/discovered-dfcf443aa4cc3eb3c7dab634a8466b0d507ca0b7d7e03e55.md","download_url":"https:\/\/skillshunter.net\/skills\/discovered-dfcf443aa4cc3eb3c7dab634a8466b0d507ca0b7d7e03e55\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Ensure branch protection rules are applied to the main branch on GitHub, including requiring PRs, status checks, linear history, and signed commits. Use OIDC for cloud deploys instead of long-lived keys in repo secrets. Secrets should be passed via environment variables, not CLI arguments.","instructions":"---\nname: ci-pipelines\nversion: 1.1.0\ndescription: GitHub Actions pipelines for typecheck, lint, test, security scan, build, and release. Also covers verifying runs after git push (gh run list\/watch). Stack-aware templates live in stacks\/<stack>\/workflows\/.\n---\n\n# CI Pipelines\n\n**ALWAYS invoke when setting up CI, modifying `.github\/workflows\/`, or wiring quality gates.**\n\n> CI is the only enforcement that survives human pressure. Anything not in CI will eventually be skipped.\n\n## Pipeline Stages (Required Order)\n\n```\n1. checkout + setup\n2. install deps (cache locked)\n3. typecheck \/ static analysis        \u2014 fail fast, cheapest\n4. lint\n5. unit tests\n6. integration tests (with services)\n7. security audit (npm\/pip\/composer audit + gitleaks)\n8. build\n9. e2e (only on main \/ PRs to main)\n10. publish artifacts (only on tag)\n```\n\n**Order matters**: cheaper gates first. A typo found by typecheck in 30s saves 10 minutes of e2e runtime.\n\n## Required Workflows per Repo\n\n| File | Triggers | Purpose |\n|---|---|---|\n| `ci.yml` | `pull_request`, `push` to main | Main pipeline |\n| `security.yml` | weekly cron + push | Audits, gitleaks, CodeQL |\n| `release.yml` | `release: published` | Publish to npm \/ PyPI \/ Docker \/ etc. |\n\n## Universal Best Practices\n\n### Concurrency (cancel stale runs)\n```yaml\nconcurrency:\n  group: ${{ github.workflow }}-${{ github.ref }}\n  cancel-in-progress: true\n```\n\n### Permissions (least privilege)\n```yaml\npermissions:\n  contents: read           # default; bump only what each job needs\n```\n\nBump per job:\n```yaml\njobs:\n  release:\n    permissions:\n      contents: write       # to create tags\n      id-token: write       # to use OIDC for npm provenance\n```\n\n### Pin actions by SHA in production\n```yaml\n- uses: actions\/checkout@b4ffde65f46336ab88eb53be808477a3936bae11   # v4.1.1\n```\n\n`Dependabot` will keep them updated. Tags can be re-pointed; SHAs cannot.\n\n### Secrets\n\n- Never `echo \"$SECRET\"` \u2014 masking is best-effort.\n- Pass to runtime via env, not CLI args (CLI shows in logs on some setups).\n- Use **OIDC** for cloud deploys (AWS \/ GCP \/ Vercel) \u2014 no long-lived keys in repo secrets.\n\n### Caching\n\n| Stack | Cache key |\n|---|---|\n| Node.js | `package-lock.json` \/ `bun.lock` \/ `pnpm-lock.yaml` |\n| Python | `requirements*.txt` \/ `uv.lock` \/ `poetry.lock` |\n| PHP | `composer.lock` |\n\n`actions\/setup-node` \/ `setup-python` provide `cache:` parameter \u2014 use it.\n\n### Matrix builds for multi-version coverage\n```yaml\nstrategy:\n  matrix:\n    node: [20, 22]\n  fail-fast: false           # see all failures, don't bail on first\n```\n\n## Branch Protection (mandatory)\n\nConfigure on GitHub: Settings \u2192 Branches \u2192 main:\n- Require PRs (no direct push to main)\n- Require status checks: `ci \/ typecheck`, `ci \/ test`, `ci \/ security`\n- Require linear history (no merge commits, only squash\/rebase)\n- Require signed commits (optional but recommended)\n- Require up-to-date branch before merge\n\n## Templates Per Stack\n\nTemplates ship in `stacks\/<stack>\/workflows\/`. Run `npx start-vibing` (or copy manually) to install them into the project's `.github\/workflows\/`.\n\n| Stack | Template files |\n|---|---|\n| `nodejs` | `ci.yml`, `security.yml` |\n| `python` | `ci.yml`, `security.yml` |\n| `php` | `ci.yml`, `security.yml` |\n\n## Release \/ Publish\n\nFor npm packages:\n```yaml\n# .github\/workflows\/release.yml\non:\n  release:\n    types: [published]\npermissions:\n  contents: read\n  id-token: write          # OIDC for provenance\njobs:\n  publish:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\/checkout@v4\n      - uses: actions\/setup-node@v4\n        with:\n          node-version: 20\n          registry-url: https:\/\/registry.npmjs.org\n      - run: npm ci\n      - run: npm run build\n      - run: npm publish --access public --provenance\n        env:\n          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}\n```\n\n`--provenance` is the 2024+ default \u2014 gives users SLSA-attested supply chain.\n\n## Pre-Commit Checklist for CI Changes\n\n- [ ] `concurrency` group set\n- [ ] `permissions: contents: read` at top, bump per job\n- [ ] Secrets via `${{ secrets.X }}`, never inline\n- [ ] Actions pinned by SHA (or at least major+minor for non-critical)\n- [ ] Quality gates ordered cheapest \u2192 most expensive\n- [ ] Caching configured for the package manager\n- [ ] Branch protection rules applied to main on GitHub\n\n## FORBIDDEN\n\n| Pattern | Reason |\n|---|---|\n| `if: always()` on the final reporter that swallows failures | CI green when tests fail |\n| `continue-on-error: true` outside of allowed-fail matrix | Hides regressions |\n| `--no-verify` in CI git operations | Bypasses other guardrails |\n| Plain text secrets in env files committed to repo | See `secrets-management` |\n| Workflow with `permissions: write-all` | Overly broad, supply chain risk |\n| Long-lived cloud creds in repo secrets | Use OIDC instead |\n\n## Verify runs after push\n\nAuthoring workflows is not enough \u2014 after `git push`, confirm the run for that SHA. Full recipe: `git-workflow` \u00a7 Post-push CI and `commit-manager` Step 5.5.\n\n```bash\ngh run list --commit \"$(git rev-parse HEAD)\" --limit 10\ngh run watch <id> --exit-status          # when still in_progress\ngh run view <id> --log-failed            # when conclusion=failure\n```\n\nMap deploy\/release success only when the job that publishes\/deploys is green (not merely \u201cCI started\u201d).\n\n## See Also\n\n- `secrets-management` \u2014 repo secrets & OIDC patterns\n- `quality-gate` \u2014 local quality gates that mirror CI\n- `git-workflow` \u2014 branch + commit conventions + post-push verification\n- Memory `post-push-ci-verification.md` \u2014 always-on checklist after push\n- `commit-manager` \u2014 enforces Step 5.5 after every push\n","use_cases":["Enforce CI pipelines for typecheck, lint, and test in a GitHub repository","Set up branch protection rules for the main branch","Implement security scans and audits in CI workflows","Publish npm packages with provenance using OIDC"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/0x57-1\/start-vibing-stacks\/blob\/6e398b34c4dfe73ac8f809216b218856b8e02ff4\/stacks\/_shared\/skills\/ci-pipelines\/SKILL.md","source_commit":"6e398b34c4dfe73ac8f809216b218856b8e02ff4","license":null,"version":null,"listing_approved_at":"2026-12-03","created_at":"2026-12-02T09:10:58.000000Z","updated_at":"2026-12-03T16:20:08.000000Z","seo_title":"GitHub Actions CI Pipeline Setup","seo_description":"Configure GitHub Actions pipelines with branch protection, workflow templates, and best practices for typecheck, lint, test, and release.","seo_keywords":["GitHub Actions CI","CI pipeline setup","branch protection rules","security audit in CI","npm package release with provenance"]}}