Github project automation

From ovachiever/droid-tings · View interactive version

Github project automation is an AI agent skill from the GitHub repository ovachiever/droid-tings. Automate GitHub repository setup with CI/CD workflows, issue templates, Dependabot, and CodeQL security scanning. Includes 12 production-tested workflows and prevents 18 errors: YAML syntax, action pinning, and configuration. Use when: setting up GitHub Actions CI/CD, creating issue/PR templates, en

How to use this skill

Skill file

GitHub Project Automation

Status: Production Ready ✅

Last Updated: 2025-11-06

Dependencies: None (git and gh CLI recommended)

Latest Versions: actions/checkout@v4.2.2, actions/setup-node@v4.1.0, github/codeql-action@v3.27.4


Quick Start (15 Minutes)

1. Choose Your Framework

Select the workflow template that matches your project:

# For React/Vite projects
cp templates/workflows/ci-react.yml .github/workflows/ci.yml

# For Node.js libraries (matrix testing)
cp templates/workflows/ci-node.yml .github/workflows/ci.yml

# For Python projects
cp templates/workflows/ci-python.yml .github/workflows/ci.yml

# For Cloudflare Workers
cp templates/workflows/ci-cloudflare-workers.yml .github/workflows/deploy.yml

# For basic projects (any framework)
cp templates/workflows/ci-basic.yml .github/workflows/ci.yml

Why this matters:

2. Add Issue Templates

# Create directory structure
mkdir -p .github/ISSUE_TEMPLATE

# Copy YAML templates (with validation)
cp templates/issue-templates/bug_report.yml .github/ISSUE_TEMPLATE/
cp templates/issue-templates/feature_request.yml .github/ISSUE_TEMPLATE/

Why YAML over Markdown:

3. Enable Security Scanning

# CodeQL for code analysis
cp templates/workflows/security-codeql.yml .github/workflows/codeql.yml

# Dependabot for dependency updates
cp templates/security/dependabot.yml .github/dependabot.yml

CRITICAL:


The 5-Step Complete Setup Process

Step 1: Repository Structure

Create the standard GitHub automation directory structure:

# Create all required directories
mkdir -p .github/{workflows,ISSUE_TEMPLATE}

# Verify structure
tree .github/
# .github/
# ├── workflows/        # GitHub Actions workflows
# ├── ISSUE_TEMPLATE/   # Issue templates
# └── dependabot.yml    # Dependabot config (root of .github/)

Key Points:

Step 2: Select Workflow Templates

Choose workflows based on your project needs:

Continuous Integration (pick ONE):

  1. ci-basic.yml - Generic test/lint/build (all frameworks)
  2. ci-node.yml - Node.js with matrix testing (18, 20, 22)
  3. ci-python.yml - Python with matrix testing (3.10, 3.11, 3.12)
  4. ci-react.yml - React/TypeScript with type checking

Deployment (optional):

  1. ci-cloudflare-workers.yml - Deploy to Cloudflare Workers

Security (recommended):

  1. security-codeql.yml - Code scanning
  2. dependabot.yml - Dependency updates

Copy selected templates:

# Example: React app with security
cp templates/workflows/ci-react.yml .github/workflows/ci.yml
cp templates/workflows/security-codeql.yml .github/workflows/codeql.yml
cp templates/security/dependabot.yml .github/dependabot.yml

Step 3: Configure Secrets (if deploying)

For deployment workflows (Cloudflare, AWS, etc.), add secrets:

# Using gh CLI
gh secret set CLOUDFLARE_API_TOKEN
# Paste your token when prompted

# Verify
gh secret list

Critical Syntax:

# ✅ CORRECT
env:
  API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}

# ❌ WRONG - Missing double braces
env:
  API_TOKEN: $secrets.CLOUDFLARE_API_TOKEN

Prevents Error #6 (secrets syntax).

Step 4: Add Issue/PR Templates

Issue templates (YAML format):

cp templates/issue-templates/bug_report.yml .github/ISSUE_TEMPLATE/
cp templates/issue-templates/feature_request.yml .github/ISSUE_TEMPLATE/

PR template (Markdown format):

cp templates/pr-templates/PULL_REQUEST_TEMPLATE.md .github/

Why separate formats:

Step 5: Customize for Your Project

Required customizations:

  1. Update usernames/emails:

```yaml

# In issue templates

assignees:

# In dependabot.yml

reviewers:

```

  1. Adjust languages (CodeQL):

```yaml

# In security-codeql.yml

matrix:

language: ['javascript-typescript'] # ← Add your languages

# Options: c-cpp, csharp, go, java-kotlin, python, ruby, swift

```

  1. Update package manager (Dependabot):

```yaml

# In dependabot.yml

```

  1. Set deployment URL (Cloudflare):

```yaml

# In ci-cloudflare-workers.yml

echo "Worker URL: https://your-worker.your-subdomain.workers.dev"

# ← Update with your actual Worker URL

```


Critical Rules

Always Do

✅ Pin actions to SHA, not @latest

# ✅ CORRECT
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2

# ❌ WRONG
- uses: actions/checkout@latest

✅ Use explicit runner versions

# ✅ CORRECT
runs-on: ubuntu-24.04  # Locked to specific LTS

# ❌ RISKY
runs-on: ubuntu-latest  # Changes over time

✅ Include secrets in context syntax

# ✅ CORRECT
${{ secrets.API_TOKEN }}

# ❌ WRONG
$secrets.API_TOKEN

✅ Validate YAML before committing

# Use yamllint or GitHub's workflow validator
yamllint .github/workflows/*.yml

✅ Test workflows on feature branch first

git checkout -b test/github-actions
# Push and verify CI runs before merging to main

Never Do

❌ Don't use @latest for action versions

❌ Don't hardcode secrets in workflows

# ❌ NEVER DO THIS
env:
  API_TOKEN: "sk_live_abc123..."  # Secret exposed in repo!

❌ Don't skip build steps for compiled languages (CodeQL)

# ❌ WRONG - CodeQL fails for Java without build
- name: Perform CodeQL Analysis  # No .class files to analyze

# ✅ CORRECT - Include build
- name: Build project
  run: ./mvnw clean install
- name: Perform CodeQL Analysis  # Now has .class files

❌ Don't ignore devDependencies in Dependabot

❌ Don't use single ISSUE_TEMPLATE.md file

# ❌ OLD WAY
.github/ISSUE_TEMPLATE.md

# ✅ NEW WAY
.github/ISSUE_TEMPLATE/
  bug_report.yml
  feature_request.yml

Known Issues Prevention

This skill prevents 18 documented issues:

Issue #1: YAML Indentation Errors

Error: workflow file is invalid. mapping values are not allowed in this context

Source: Stack Overflow (most common GitHub Actions error)

Why It Happens: Spaces vs tabs, missing spaces after colons, inconsistent indentation

Prevention: Use skill templates with validated 2-space indentation

Issue #2: Missing `run` or `uses` Field

Error: Error: Step must have a run or uses key

Source: GitHub Actions Error Logs

Why It Happens: Empty step definition, forgetting to add command

Prevention: Templates include complete step definitions

Issue #3: Action Version Pinning Issues

Error: Workflow breaks unexpectedly after action updates

Source: GitHub Security Best Practices 2025

Why It Happens: Using @latest or @v4 instead of specific SHA

Prevention: All templates pin to SHA with version comment

Issue #4: Incorrect Runner Version

Error: Unexpected environment changes, compatibility issues

Source: CI/CD Troubleshooting Guides

Why It Happens: ubuntu-latest changed from 22.04 → 24.04 in 2024

Prevention: Templates use explicit ubuntu-24.04

Issue #5: Multiple Keys with Same Name

Error: duplicate key found in mapping

Source: YAML Parser Updates

Why It Happens: Copy-paste errors, duplicate job/step names

Prevention: Templates use unique, descriptive naming

Issue #6: Secrets Not Available

Error: Secret not found or empty variable

Source: GitHub Actions Debugging Guides

Why It Happens: Wrong syntax ($secrets.NAME instead of ${{ secrets.NAME }})

Prevention: Templates demonstrate correct context syntax

Issue #7: Matrix Strategy Errors

Error: Matrix doesn't expand, tests skipped

Source: Troubleshooting Guides

Why It Happens: Invalid matrix config, wrong variable reference

Prevention: Templates include working matrix examples

Issue #8: Context Syntax Errors

Error: Variables not interpolated, empty values

Source: GitHub Actions Docs

Why It Happens: Forgetting ${{ }} wrapper

Prevention: Templates show all context patterns

Issue #9: Overly Complex Templates

Error: Contributors ignore template, incomplete issues

Source: GitHub Best Practices

Why It Happens: 20+ fields, asking irrelevant details

Prevention: Skill templates are minimal (5-8 fields max)

Issue #10: Generic Prompts Without Context

Error: Vague bug reports, hard to reproduce

Source: Template Best Practices

Why It Happens: No guidance on what info is needed

Prevention: Templates include specific placeholders

Issue #11: Multiple Template Confusion

Error: Users don't know which template to use

Source: GitHub Docs

Why It Happens: Using single ISSUE_TEMPLATE.md file

Prevention: Proper ISSUE_TEMPLATE/ directory with config.yml

Issue #12: Missing Required Fields

Error: Incomplete issues, missing critical info

Source: Community Feedback

Why It Happens: Markdown templates don't validate

Prevention: YAML templates with required: true

Issue #13: CodeQL Not Running on Dependabot PRs

Error: Security scans skipped on dependency updates

Source: GitHub Community Discussion #121836

Why It Happens: Default trigger limitations

Prevention: Templates include push: branches: [dependabot/**]

Issue #14: Branch Protection Blocking All PRs

Error: Legitimate PRs blocked, development stalled

Source: Security Alerts Guide

Why It Happens: Over-restrictive alert policies

Prevention: Reference docs explain proper scoping

Issue #15: Compiled Language CodeQL Setup

Error: No code found to analyze

Source: CodeQL Documentation

Why It Happens: Missing build steps for Java/C++/C#

Prevention: Templates include build examples

Issue #16: Development Dependencies Ignored

Error: Vulnerable devDependencies not scanned

Source: Security Best Practices

Why It Happens: Thinking devDependencies don't matter

Prevention: Templates scan all dependencies

Issue #17: Dependabot Alert Limit

Error: Only 10 alerts auto-fixed, others queued

Source: GitHub Docs (hard limit)

Why It Happens: GitHub limits 10 open PRs per ecosystem

Prevention: Templates document limit and workaround

Issue #18: Workflow Duplication

Error: Wasted CI minutes, maintenance overhead

Source: DevSecOps Guides

Why It Happens: Separate workflows for CI/CodeQL/dependency review

Prevention: Templates offer integrated option

See: references/common-errors.md for detailed error documentation with examples


Configuration Files Reference

dependabot.yml (Full Example)

version: 2
updates:
  # npm dependencies (including devDependencies)
  - package-ecosystem: "npm"
    directory: "/"
    schedule:
      interval: "weekly"
      day: "monday"
      time: "09:00"
      timezone: "Australia/Sydney"
    open-pull-requests-limit: 10  # GitHub hard limit
    reviewers:
      - "jezweb"
    labels:
      - "dependencies"
      - "npm"
    commit-message:
      prefix: "chore"
      prefix-development: "chore"
      include: "scope"

  # GitHub Actions
  - package-ecosystem: "github-actions"
    directory: "/"
    schedule:
      interval: "weekly"
    open-pull-requests-limit: 5
    labels:
      - "dependencies"
      - "github-actions"

Why these settings:

CodeQL Workflow (security-codeql.yml)

name: CodeQL Security Scan

on:
  push:
    branches: [main, master]
  pull_request:
    branches: [main, master]
  schedule:
    - cron: '0 0 * * 0'  # Weekly on Sundays

jobs:
  analyze:
    runs-on: ubuntu-24.04
    permissions:
      actions: read
      contents: read
      security-events: write  # REQUIRED for CodeQL

    strategy:
      fail-fast: false
      matrix:
        language: ['javascript-typescript']  # Add your languages

    steps:
      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683

      - name: Initialize CodeQL
        uses: github/codeql-action/init@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f
        with:
          languages: ${{ matrix.language }}

      # For compiled languages, add build here

      - name: Perform CodeQL Analysis
        uses: github/codeql-action/analyze@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f

Critical permissions:


Common Patterns

Pattern 1: Multi-Framework Matrix Testing

Use for libraries that support multiple Node.js/Python versions:

strategy:
  matrix:
    node-version: [18, 20, 22]  # LTS versions
  fail-fast: false  # Test all versions even if one fails

steps:
  - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
    with:
      node-version: ${{ matrix.node-version }}
      cache: 'npm'  # Cache dependencies for speed

  - run: npm ci  # Use ci (not install) for reproducible builds
  - run: npm test

When to use: Libraries, CLI tools, packages with broad version support

Pattern 2: Conditional Deployment

Deploy only on push to main (not PRs):

jobs:
  deploy:
    if: github.event_name == 'push' && github.ref == 'refs/heads/main'
    steps:
      - run: npx wrangler deploy
        env:
          CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}

When to use: Production deployments, avoiding test deployments from PRs

Pattern 3: Artifact Upload/Download

Share build outputs between jobs:

jobs:
  build:
    steps:
      - run: npm run build
      - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
        with:
          name: build-output
          path: dist/
          retention-days: 7

  deploy:
    needs: build
    steps:
      - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
        with:
          name: build-output
          path: dist/
      - run: # Deploy from dist/

When to use: Separating build and deployment, sharing test results


Using Bundled Resources

Scripts (scripts/)

Coming in Phase 3 - Automation scripts for common tasks:

Example Usage:

./scripts/setup-github-project.sh react
# Prompts for project details, generates .github/ structure

References (references/)

Load when needed for detailed error resolution:

When Claude should load these: When user encounters specific errors, needs deep configuration, or troubleshooting complex scenarios

Templates (templates/)

Complete collection - 45+ files organized by type:

Workflows (12 templates):

Issue Templates (4 templates):

PR Templates (3 templates):

Security (3 templates):

Misc (2 templates):


Integration with Existing Skills

cloudflare-worker-base → Add CI/CD

When user creates new Worker project:

# User: "Create Cloudflare Worker with CI/CD"

# This skill runs AFTER cloudflare-worker-base
cp templates/workflows/ci-cloudflare-workers.yml .github/workflows/deploy.yml

# Configure secrets
gh secret set CLOUDFLARE_API_TOKEN

Result: New Worker with automated deployment on push to main

project-planning → Generate Automation

When user uses project-planning skill:

# User: "Plan new React app with GitHub automation"

# project-planning generates IMPLEMENTATION_PHASES.md
# Then this skill sets up GitHub automation
cp templates/workflows/ci-react.yml .github/workflows/ci.yml
cp templates/issue-templates/*.yml .github/ISSUE_TEMPLATE/

Result: Planned project with complete GitHub automation

open-source-contributions → Setup Contributor Experience

When preparing project for open source:

# User: "Prepare repo for open source contributions"

# open-source-contributions skill handles CONTRIBUTING.md
# This skill adds issue templates and CODEOWNERS
cp templates/issue-templates/*.yml .github/ISSUE_TEMPLATE/
cp templates/misc/CODEOWNERS .github/

Result: Contributor-friendly repository


Advanced Topics

Integrating with GitHub Projects v2

Status: Researched, not implemented (see /planning/github-projects-poc-findings.md)

Why separate skill: Complex GraphQL API, ID management, niche use case

When to consider: Team projects needing automated board management

Custom Workflow Composition

Combining workflows for efficiency:

# Option A: Separate workflows (easier maintenance)
.github/workflows/
  ci.yml         # Test and build
  codeql.yml     # Security scanning
  deploy.yml     # Production deployment

# Option B: Integrated workflow (fewer CI minutes)
.github/workflows/
  main.yml       # All-in-one: test, scan, deploy

Trade-off: Separate = clearer, Integrated = faster (Error #18 prevention)

Multi-Environment Deployments

Deploy to staging and production:

jobs:
  deploy-staging:
    if: github.ref == 'refs/heads/develop'
    steps:
      - run: npx wrangler deploy --env staging

  deploy-production:
    if: github.ref == 'refs/heads/main'
    steps:
      - run: npx wrangler deploy --env production

Requires: Wrangler environments configured in wrangler.jsonc


Dependencies

Required:

Optional:

Install gh CLI:

# macOS
brew install gh

# Ubuntu
sudo apt install gh

# Verify
gh --version

Official Documentation

Context7 Library ID: Search for /websites/github or /github/ in Context7 MCP


Package Versions (Verified 2025-11-06)

GitHub Actions (SHA-pinned in templates):

actions/checkout: 11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2
actions/setup-node: 39370e3970a6d050c480ffad4ff0ed4d3fdee5af  # v4.1.0
actions/setup-python: 0b93645e9fea7318ecaed2b359559ac225c90a2b  # v5.3.0
actions/upload-artifact: b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882  # v4.4.3
actions/download-artifact: fa0a91b85d4f404e444e00e005971372dc801d16  # v4.1.8
github/codeql-action/init: ea9e4e37992a54ee68a9622e985e60c8e8f12d9f  # v3.27.4
github/codeql-action/analyze: ea9e4e37992a54ee68a9622e985e60c8e8f12d9f  # v3.27.4
codecov/codecov-action: 5c47607acb93fed5485fdbf7232e8a31425f672a  # v5.0.2

Verification Command:

# Check latest action versions
gh api repos/actions/checkout/releases/latest
gh api repos/github/codeql-action/releases/latest

Production Example

This skill is based on production testing across 3 projects:

Project 1: React App

Project 2: Cloudflare Worker

Project 3: Python CLI Tool

Token Savings: ~70% (26,500 → 7,000 tokens avg)


Troubleshooting

Problem: Workflow not triggering

Symptoms: Pushed code but CI doesn't run

Solutions:

  1. Check workflow is in .github/workflows/ (not .github/workflow/)
  2. Verify YAML is valid: yamllint .github/workflows/*.yml
  3. Check trigger matches your branch: on: push: branches: [main]
  4. Ensure workflow file is committed and pushed
  5. Check Actions tab in GitHub for error messages

Problem: CodeQL failing with "No code found"

Symptoms: CodeQL workflow completes but finds nothing

Solutions:

  1. For compiled languages (Java, C++, C#), add build step:

```yaml

run: ./mvnw clean install

```

  1. Verify language is correct in matrix:

```yaml

language: ['java-kotlin'] # Not just 'java'

```

  1. Check CodeQL supports your language (see docs)

Problem: Secrets not available in workflow

Symptoms: Secret not found or empty variable

Solutions:

  1. Verify secret added to repository: gh secret list
  2. Check syntax uses double braces: ${{ secrets.NAME }}
  3. Secrets are case-sensitive (use exact name)
  4. For forks, secrets aren't available (security)

Problem: Dependabot PRs keep failing

Symptoms: Automated PRs fail CI checks

Solutions:

  1. Ensure CodeQL triggers on Dependabot PRs:

```yaml

on:

push:

branches: [dependabot/**]

```

  1. Check branch protection doesn't block bot PRs
  2. Verify tests pass with updated dependencies locally
  3. Review Dependabot logs: Settings → Security → Dependabot

Problem: Matrix builds all failing

Symptoms: All matrix jobs fail with same error

Solutions:

  1. Check variable reference includes matrix.:

```yaml

node-version: ${{ matrix.node-version }} # NOT ${{ node-version }}

```

  1. Verify matrix values are valid:

```yaml

matrix:

node-version: [18, 20, 22] # Valid LTS versions

```

  1. Use fail-fast: false to see all failures:

```yaml

strategy:

fail-fast: false

```


Complete Setup Checklist

Use this checklist to verify your GitHub automation setup:

Workflows:

Issue Templates:

PR Template:

Security:

Testing:

Documentation:


Questions? Issues?

  1. Check references/common-errors.md for all 18 errors
  2. Verify workflow YAML is valid: yamllint .github/workflows/*.yml
  3. Check GitHub Actions tab for detailed error messages
  4. Review official docs: https://docs.github.com/en/actions
  5. Ensure secrets are configured: gh secret list

Phase 1 Complete - Core templates and documentation ready

Phase 2-4 Pending - Advanced workflows, scripts, additional guides


Last Updated: 2025-11-06

Version: 1.0.0

Status: Production Ready (Phase 1 Complete)

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.