Github actions

From el-feo/ai-context · View interactive version

Github actions is an AI agent skill from the GitHub repository el-feo/ai-context. Create, evaluate, and optimize GitHub Actions workflows and custom actions. Use when building CI/CD pipelines, creating workflow files, developing custom actions, troubleshooting workflow failures, performing security analysis, optimizing performance, or reviewing GitHub Actions best practices. Cove

How to use this skill

Skill file

GitHub Actions

GitHub Actions automates software workflows with event-driven CI/CD pipelines. Workflows are YAML files in .github/workflows/ that define jobs, steps, and actions triggered by repository events.

Action types:

Quick Start

# .github/workflows/ci.yml
name: CI
on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

permissions:
  contents: read

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run tests
        run: npm test

Ruby/Rails with RSpec:

- uses: ruby/setup-ruby@v1
  with:
    ruby-version: .ruby-version
    bundler-cache: true

- name: Setup database
  env:
    RAILS_ENV: test
  run: bin/rails db:setup

- run: bundle exec rspec

TypeScript/Node.js:

- uses: actions/setup-node@v4
  with:
    node-version: '20'
    cache: 'npm'

- run: npm ci
- run: npm run build --if-present
- run: npm test

Deploy to Fly.io:

- uses: superfly/flyctl-actions/setup-flyctl@1.5
- run: flyctl deploy --remote-only
  env:
    FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

Creating Workflows

  1. Identify triggers: push, pull_request, workflow_dispatch, schedule, etc.
  2. Define jobs: Specify runner OS, steps, and dependencies
  3. Add security: Set GITHUB_TOKEN permissions to read-only, pin actions to SHA
  4. Optimize performance: Enable caching, use matrix builds for parallelization
  5. Test locally: Use act or GitHub CLI to test before pushing

Evaluating Workflows

  1. Security scan: Check permissions, secrets exposure, action pinning, pull_request_target usage
  2. Performance analysis: Identify slow steps, missing caches, parallelization opportunities
  3. Best practices review: Validate naming, structure, error handling, documentation

Critical Security Patterns

  1. Always set GITHUB_TOKEN permissions to read-only:

```yaml

permissions:

contents: read

```

  1. Pin actions to commit SHA (most secure):

```yaml

```

  1. Use OIDC for cloud deployments (credential-less):

```yaml

permissions:

id-token: write

contents: read

```

  1. Avoid pull_request_target with untrusted code - runs in base repository context with access to secrets
  1. Never log secrets - use ::add-mask:: for dynamic values
  1. Validate user-controlled inputs via environment variables:

```yaml

TITLE: ${{ github.event.issue.title }}

run: echo "Title: $TITLE"

```

For complete security guidelines, see references/security-checklist.md.

Key Anti-Patterns

Concurrency Control

Cancel outdated runs to save resources:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

Reference Guides

For detailed information on specific topics:

Validation Checklist

Pre-deployment:

Post-deployment:

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.