Skip to main content
skill CX Codex

github-actions · bagelhole — Claude Code skill: CI/CD with GitHub Actions

A skill that gets your agent writing GitHub Actions workflows: builds, tests, deploys, secrets, caching and self-hosted runners.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add BagelHole/DevOps-Security-Agent-Skills --skill github-actions -a claude-code
Open on GitHub

What github-actions does

The skill hands the agent working YAML patterns for .github/workflows/. You can build a pipeline from scratch: push and pull_request triggers, cron schedules, manual runs through workflow_dispatch with an environment choice. Then matrix builds across Node.js versions and operating systems, job ordering with needs, and environment protection before deploy.

Secrets and variables are covered too (secrets.*, vars.*), along with dependency caching via actions/cache@v4, artifact upload and download, and Docker image builds with a Docker Hub login. Two more sections deal with reusable workflows using workflow_call and registering a self-hosted runner with config.sh.

You need a GitHub repository with write access and some comfort with YAML syntax. A self-hosted runner also wants a server with Docker. When a workflow refuses to fire on push, the skill points at branch and path filters first: the file has to sit on the default branch. Push and PR permissions come from a permissions block inside the workflow itself.

What it helps with

  • set up a CI pipeline that builds and tests on every push
  • run the same job across several Node.js versions and OSes
  • move deploy into a reusable workflow with workflow_call
  • wire up secrets and environment variables without leaking them to logs
  • figure out why a workflow never triggers or fails on permissions

Example prompts for the agent

  • Write a workflow that builds and tests a Node.js project on push to main
  • Add npm caching and upload the dist/ artifact to this pipeline
  • Create a reusable deploy workflow for staging that takes a deploy_key secret

How to install github-actions

1Skills CLI (Vercel)

npx skills add BagelHole/DevOps-Security-Agent-Skills --skill github-actions -a claude-code

2Manually: put the files in place

~/.claude/skills/github-actions/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/github-actions/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about github-actions

How do I install github-actions in Claude?

Run npx skills add BagelHole/DevOps-Security-Agent-Skills --skill github-actions -a claude-code. The skill file lands at ~/.claude/skills/github-actions/SKILL.md.

What does the github-actions skill do?

It helps the agent write and debug GitHub Actions workflows: triggers, jobs, secrets, caching, artifacts, Docker builds and self-hosted runners.

What do I need before using it?

A GitHub repository with write access and working knowledge of YAML. For self-hosted runners, a server with Docker.

Source text

SKILL.md · MIT
---
name: github-actions
description: Build, test, and deploy applications using GitHub Actions workflows. Create CI/CD pipelines, configure runners, manage secrets, and automate software delivery. Use when working with GitHub repositories, automating builds, running tests, or deploying applications.
license: MIT
metadata:
  author: devops-skills
  version: "1.0"
---

# GitHub Actions

Automate software workflows directly in your GitHub repository with GitHub Actions.

## When to Use This Skill

Use this skill when:
- Setting up CI/CD pipelines for GitHub repositories
- Automating build, test, and deployment workflows
- Creating reusable workflow components
- Configuring self-hosted runners
- Managing workflow secrets and variables
- Debugging failed workflow runs

## Prerequisites

- GitHub repository with write access
- Understanding of YAML syntax
- For self-hosted runners: server with Docker (optional)

## Workflow File Structure

Workflows are defined in `.github/workflows/` directory:

```yaml
name: CI Pipeline

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

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'npm'
      - run: npm ci
      - run: npm test
```

## Common Triggers

### Push and Pull Request

```yaml
on:
  push:
    branches: [main]
    paths:
      - 'src/**'
      - 'package.json'
  pull_request:
    branches: [main]
```

### Scheduled Runs

```yaml
on:
  schedule:
    - cron: '0 2 * * *'  # Daily at 2 AM UTC
```

### Manual Dispatch

```yaml
on:
  workflow_dispatch:
    inputs:
      environment:
        description: 'Deployment environment'
        required: true
        default: 'staging'
        type: choice
        options:
          - staging
          - production
```

## Job Configuration

### Matrix Builds

```yaml
jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [18, 20, 22]
        os: [ubuntu-latest, windows-latest]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node-version }}
      - run: npm test
```

### Job Dependencies

```yaml
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - run: npm run build
      
  test:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - run: npm test
      
  deploy:
    needs: [build, test]
    runs-on: ubuntu-latest
    steps:
      - run: ./deploy.sh
```

### Environment Protection

```yaml
jobs:
  deploy:
    runs-on: ubuntu-latest
    environment:
      name: production
      url: https://example.com
    steps:
      - run: ./deploy.sh
```

## Secrets and Variables

### Using Secrets

```yaml
steps:
  - name: Deploy
    env:
      AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
      AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
    run: aws s3 sync ./dist s3://my-bucket
```

### Using Variables

```yaml
steps:
  - name: Build
    env:
      API_URL: ${{ vars.API_URL }}
    run: npm run build
```

## Caching Dependencies

```yaml
- uses: actions/cache@v4
  with:
    path: ~/.npm
    key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
    restore-keys: |
      ${{ runner.os }}-node-
```

## Artifacts

### Upload Artifacts

```yaml
- uses: actions/upload-artifact@v4
  with:
    name: build-output
    path: dist/
    retention-days: 5
```

### Download Artifacts

```yaml
- uses: actions/download-artifact@v4
  with:
    name: build-output
    path: dist/
```

## Docker Builds

```yaml
jobs:
  docker:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      
      - name: Login to Docker Hub
        uses: docker/login-action@v3
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}
      
      - name: Build and push
        uses: docker/build-push-action@v5
        with:
          context: .
          push: true
          tags: user/app:latest
```

## Reusable Workflows

### Define Reusable Workflow

```yaml
# .github/workflows/reusable-deploy.yml
name: Reusable Deploy

on:
  workflow_call:
    inputs:
      environment:
        required: true
        type: string
    secrets:
      deploy_key:
        required: true

jobs:
  deploy:
    runs-on: ubuntu-latest
    environment: ${{ inputs.environment }}
    steps:
      - run: echo "Deploying to ${{ inputs.environment }}"
```

### Call Reusable Workflow

```yaml
jobs:
  deploy-staging:
    uses: ./.github/workflows/reusable-deploy.yml
    with:
      environment: staging
    secrets:
      deploy_key: ${{ secrets.STAGING_KEY }}
```

## Self-Hosted Runners

### Register Runner

```bash
# Download runner
mkdir actions-runner && cd actions-runner
curl -o actions-runner-linux-x64.tar.gz -L https://github.com/actions/runner/releases/download/v2.311.0/actions-runner-linux-x64-2.311.0.tar.gz
tar xzf actions-runner-linux-x64.tar.gz

# Configure
./config.sh --url https://github.com/OWNER/REPO --token TOKEN

# Run
./run.sh
```

### Use Self-Hosted Runner

```yaml
jobs:
  build:
    runs-on: self-hosted
    steps:
      - uses: actions/checkout@v4
```

## Debugging Workflows

### Enable Debug Logging

Set repository secrets:
- `ACTIONS_RUNNER_DEBUG`: `true`
- `ACTIONS_STEP_DEBUG`: `true`

### Debug Step

```yaml
- name: Debug
  run: |
    echo "GitHub context: ${{ toJson(github) }}"
    echo "Job context: ${{ toJson(job) }}"
```

## Common Issues

### Issue: Workflow Not Triggering
**Problem**: Workflow doesn't run on push/PR
**Solution**: Check branch filters, path filters, and ensure workflow file is on the default branch

### Issue: Permission Denied
**Problem**: Actions can't push or create PRs
**Solution**: Configure `permissions` in workflow or update repository settings

```yaml
permissions:
  contents: write
  pull-requests: write
```

### Issue: Cache Not Restoring
**Problem**: Cache misses despite existing cache
**Solution**: Verify cache key matches exactly, check runner OS

## Best Practices

- Pin action versions to specific commits or tags
- Use caching for dependencies to speed up builds
- Minimize secrets exposure with environment scoping
- Use matrix builds for cross-platform testing
- Implement proper error handling with `continue-on-error`
- Keep workflows DRY with reusable workflows and composite actions

## Related Skills

- [gitlab-ci](../gitlab-ci/) - GitLab CI/CD alternative
- [docker-management](../../containers/docker-management/) - Container builds
- [semantic-versioning](../../release/semantic-versioning/) - Automated releases

© devops-skills · MIT · BagelHole/DevOps-Security-Agent-Skills

Similar skills

Everything for DevOps and infrastructure →

github-actions by other authors comes first.

github-actions callstackincubator Reusable GitHub Actions patterns to build React Native apps for iOS simulators and Android emulators in the cloud and download artifacts. Simplifies CI pipeline setup and scripted retrieval via gh CLI or REST API. CX Codex +1 10,900installs github-actions-generator akin-ozer This skill scaffolds GitHub Actions workflows, custom actions and reusable pipelines from a plain request. Handy when you need working .github/workflows files without hand-picking action versions. CX Codex +1 643installs github-actions-hardening official github Reviews .github/workflows/*.yml against the Actions threat model linters miss: attacker-controlled text pasted into run:, privileged triggers running fork code, unpinned actions. 2,200installs github-actions-ci-cd-best-practices official github A GitHub Copilot rule that guides workflow structure, token permissions, caching and matrix setups whenever you touch files under .github/workflows/. ★ 40,418repo stars github-actions-workflow aj-geddes A skill that helps your agent write GitHub Actions workflows for tests, builds, security scans and deploys. CX Codex +1 620installs github-actions-validator akin-ozer Validates GitHub Actions workflows with actionlint and runs them locally using act. Catches runner typos, expression bugs, and outdated action versions before you push. CX Codex +1 638installs github-actions-templates Seth Hobson This skill creates GitHub Actions workflows for testing, builds, and deployments. Use it when a project needs CI/CD or reusable workflow templates. CX Codex 17,420installs

From the same set127

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor