Skip to content

Add GitHub Actions CI/CD workflow #4

@BekahHW

Description

@BekahHW

Description

RepoReady needs a CI/CD pipeline to automate testing, linting, and potentially publishing. This will ensure code quality and make the development process more robust for contributors.

Current State

  • ❌ No .github/workflows/ directory exists
  • ❌ No automated testing on pull requests
  • ❌ No automated builds or checks
  • ✅ npm scripts are configured (build, test, etc.)
  • ✅ TypeScript compilation is set up

Acceptance Criteria

Basic CI Workflow

  • Create .github/workflows/ci.yml
  • Set up Node.js matrix testing (Node 16, 18, 20)
  • Run on pull requests and pushes to main
  • Install dependencies and run build
  • Run tests (once test suite is implemented)
  • Run linting (once ESLint is set up)

Advanced Features (Optional)

  • Add code coverage reporting
  • Cache node_modules for faster builds
  • Add semantic release workflow
  • Add npm publish workflow for releases
  • Add security scanning

Status Checks

  • Configure branch protection rules requiring CI to pass
  • Add status badges to README.md
  • Ensure workflow runs successfully

Implementation Suggestions

Basic CI Workflow

# .github/workflows/ci.yml
name: CI

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  test:
    runs-on: ubuntu-latest
    
    strategy:
      matrix:
        node-version: [16, 18, 20]
    
    steps:
    - name: Checkout code
      uses: actions/checkout@v4
    
    - name: Setup Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v4
      with:
        node-version: ${{ matrix.node-version }}
        cache: 'npm'
    
    - name: Install dependencies
      run: npm ci
    
    - name: Run linting
      run: npm run lint
    
    - name: Run tests
      run: npm test
    
    - name: Build project
      run: npm run build
    
    - name: Test CLI commands
      run: |
        node dist/index.js --help
        node dist/index.js intro

Release Workflow (Advanced)

# .github/workflows/release.yml
name: Release

on:
  push:
    tags:
      - 'v*'

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: actions/setup-node@v4
      with:
        node-version: '18'
        registry-url: 'https://registry.npmjs.org'
    
    - run: npm ci
    - run: npm run build
    - run: npm test
    
    - name: Publish to npm
      run: npm publish
      env:
        NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Files to Create

  • .github/workflows/ci.yml
  • .github/workflows/release.yml (optional)
  • Update README.md with status badges

Status Badges for README

[![CI](https://github.com/OpenSource-Communities/RepoReady/actions/workflows/ci.yml/badge.svg)](https://github.com/OpenSource-Communities/RepoReady/actions/workflows/ci.yml)
[![npm version](https://img.shields.io/npm/v/repoready.svg)](https://www.npmjs.com/package/repoready)

Dependencies Considerations

  • This issue works best after the testing and linting issues are implemented
  • Can be started independently and updated as other tools are added
  • Consider adding workflow for the test script that exists (test-org-community-files.js)

Benefits

  • 🔄 Automated quality checks on every PR
  • 🛡️ Prevents broken code from being merged
  • ⚡ Faster feedback for contributors
  • 📦 Automated releases and publishing
  • 🔍 Consistent testing across different Node.js versions

Resources

Estimated Effort

Medium - Requires understanding of CI/CD concepts but well-documented patterns exist.


Great for contributors interested in DevOps and automation! ⚙️

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions