AgileFlow

/ci-setup

PreviousNext

Bootstrap CI/CD workflow with testing and quality checks

/ci-setup

Bootstrap a minimal CI/CD workflow with automated testing and quality checks integrated with GitHub Actions and code ownership rules.

Quick Start

/agileflow:ci-setup OWNERS=@username,@team

Purpose

This command sets up a complete CI/CD foundation for your project by:

  • Creating a GitHub Actions workflow with lint, typecheck, and test jobs
  • Establishing code ownership through a CODEOWNERS file
  • Configuring permissions and concurrency controls
  • Providing guidance on enabling required checks

Parameters

ParameterRequiredDefaultDescription
OWNERSYes-GitHub usernames or team handles (comma-separated, e.g., @alice,@team-backend)

Examples

Basic Usage

/agileflow:ci-setup OWNERS=@alice,@bob

Sets up CI with Alice and Bob as code owners.

Multiple Team Handles

/agileflow:ci-setup OWNERS=@frontend-team,@devops-team,@maintainer

Assigns multiple teams as code owners for code review requirements.

Workflow

The command follows a consistent workflow:

  1. Parse Owners Input - Validates and normalizes GitHub handles
  2. Generate CI Workflow - Creates .github/workflows/ci.yml with three jobs:
    • Lint Job - Placeholder for ESLint, Prettier, or similar
    • Typecheck Job - Placeholder for TypeScript, Flow, mypy, or similar
    • Test Job - Placeholder for Jest, pytest, cargo test, or similar
  3. Generate CODEOWNERS - Creates ownership mappings:
    • /src/ → assigned owners
    • /docs/03-decisions/ → assigned owners
  4. Show Preview - Displays both generated files for review
  5. Await Confirmation - Asks "Create these files? (YES/NO)"
  6. Create Files - Writes CI workflow and CODEOWNERS if approved
  7. Display Next Steps - Shows how to enable required checks in GitHub

Output Files

The command creates two files:

.github/workflows/ci.yml - GitHub Actions workflow with:

  • Runs on: push and pull_request events
  • Three jobs: lint, typecheck, test (minimal permissions)
  • Concurrency control (cancels in-progress runs)
  • Generic job commands for customization

CODEOWNERS - Code ownership configuration:

/src/ @owners
/docs/03-decisions/ @owners

CI Jobs

Each job is configured as a placeholder for customization:

Lint Job

  • Runs on: ubuntu-latest
  • Purpose: Code style and quality checks
  • Customize with: npm run lint, eslint ., prettier --check, etc.

Typecheck Job

  • Runs on: ubuntu-latest
  • Purpose: Type safety verification
  • Customize with: tsc --noEmit, flow check, mypy, etc.

Test Job

  • Runs on: ubuntu-latest
  • Purpose: Automated test execution
  • Customize with: npm test, pytest, cargo test, etc.

Next Steps

After setup completes, you need to:

  1. Customize Job Commands

    • Edit .github/workflows/ci.yml
    • Replace generic commands with your project's actual commands
  2. Enable Branch Protection

    • Go to GitHub repository Settings
    • Navigate to Branches → Branch protection rules
    • Create rule for main branch
  3. Add Required Status Checks

    • In branch protection settings, enable:
      • ✓ Require status checks to pass
      • ✓ Require branches to be up to date
      • ✓ Include administrators
    • Select which checks are required (lint, typecheck, test)
  4. Configure Code Review

    • Enable: Require pull request reviews
    • Set number of reviewers (e.g., 1 or 2)
    • Dismiss stale pull request approvals
    • Require code owner reviews (uses CODEOWNERS file)
  5. Optional: Merge Queue

    • Enable GitHub merge queue for safer deployments
    • Automatically merges after all checks pass

Customization

The generated workflow files are starting points. You should customize:

In .github/workflows/ci.yml:

# Change these commands to match your project
- run: npm run lint  # ESLint, Prettier, stylelint, etc.
- run: npm run typecheck  # TypeScript, Flow, mypy, etc.
- run: npm test  # Jest, pytest, cargo test, etc.

In CODEOWNERS:

# Add more specific paths as your project grows
/src/api/ @api-team
/src/ui/ @frontend-team
/docs/ @documentation-team
*.md @maintainers