Skip to content

Getting Started

KevinDeBenedetti/github-workflows is a library of reusable GitHub Actions workflows and composite actions. Callers stay minimal — CI steps run consistently across all your repos.

Prerequisites

  • A GitHub repository
  • Appropriate secrets set in your repo/org (see each workflow's docs)

How it works

Workflows are called with workflow_call and referenced from your own workflow files:

yaml
jobs:
  ci:
    uses: KevinDeBenedetti/github-workflows/.github/workflows/<name>.yml@main
    secrets: inherit

Production tip: Pin to a commit SHA instead of @main for reproducible builds.

Important: All workflow files must live at the flat root of .github/workflows/. GitHub Actions does not support reusable workflows in subdirectories.


Quick start by stack

Node.js

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

jobs:
  ci:
    uses: KevinDeBenedetti/github-workflows/.github/workflows/ci-node.yml@main
    secrets: inherit

Auto-detects pnpm or bun from your lockfile. Runs lint → typecheck → test → build. → Full reference


Python

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

jobs:
  ci:
    uses: KevinDeBenedetti/github-workflows/.github/workflows/ci-python.yml@main
    secrets: inherit

Uses uv and ruff. Runs lint → format check → test. → Full reference


Shell scripts

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

jobs:
  ci:
    uses: KevinDeBenedetti/github-workflows/.github/workflows/ci-shell.yml@main
    secrets: inherit

Runs ShellCheck → actionlint → Bats. → Full reference


Docker

yaml
jobs:
  deploy:
    uses: KevinDeBenedetti/github-workflows/.github/workflows/deploy-docker.yml@main
    with:
      image-name: my-app
      tag-latest: true
    secrets: inherit

Builds and pushes a multi-platform image to GHCR (ghcr.io). → Full reference


GitHub Pages

yaml
jobs:
  deploy:
    uses: KevinDeBenedetti/github-workflows/.github/workflows/deploy-pages.yml@main
    with:
      output-directory: dist
    secrets: inherit

Full reference


Vercel

Requires three secrets: VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID.

yaml
jobs:
  deploy:
    uses: KevinDeBenedetti/github-workflows/.github/workflows/deploy-vercel.yml@main
    with:
      environment: preview
    secrets: inherit

Full reference


Automated releases

yaml
jobs:
  release:
    uses: KevinDeBenedetti/github-workflows/.github/workflows/release.yml@main
    secrets: inherit

Uses release-please. Automatically moves a v<major> tag after each release. → Full reference


Security scanning

yaml
jobs:
  security:
    uses: KevinDeBenedetti/github-workflows/.github/workflows/security.yml@main
    secrets: inherit

Combines Gitleaks secret scanning, CodeQL SAST, and optional dependency audits. → Full reference


Repository maintenance (purge)

Keep deployments and workflow run history clean automatically:

yaml
# .github/workflows/maintenance.yml
name: Maintenance
on:
  schedule:
    - cron: '0 3 * * 0'  # Every Sunday at 03:00 UTC
  workflow_dispatch:

jobs:
  purge-deployments:
    uses: KevinDeBenedetti/github-workflows/.github/workflows/purge-deployments.yml@main
    with:
      keep: 10       # keep the 10 most-recent deployments per environment
      dry-run: false
    secrets: inherit

  purge-workflow-runs:
    uses: KevinDeBenedetti/github-workflows/.github/workflows/purge-workflow-runs.yml@main
    with:
      keep: 10       # keep the 10 most-recent runs per workflow
      dry-run: false
    secrets: inherit

Deployments reference · Workflow runs reference


All available workflows

WorkflowDescriptionDoc
ci-node.ymlNode.js CI (lint → typecheck → test → build)
ci-python.ymlPython CI (lint → format → typecheck → test)
ci-shell.ymlShell CI (ShellCheck → actionlint → Bats)
deploy-docker.ymlBuild & push multi-platform Docker image to GHCR
deploy-pages.ymlBuild & deploy static site to GitHub Pages
deploy-vercel.ymlDeploy preview or production to Vercel
release.ymlAutomated releases via release-please
security.ymlSecret scan + CodeQL SAST + dependency audit
purge-deployments.ymlDelete old deployments, keep last N per environment
purge-workflow-runs.ymlDelete old workflow runs, keep last N per workflow
actions-autoupdate.ymlBump pinned action versions and open a PR
prek-autoupdate.ymlBump prek hook revisions and open a PR
label-sync.ymlSync labels.yml to GitHub labels
dispatch-docs.ymlTrigger a remote docs rebuild via repository_dispatch
dependabot-automerge.ymlAuto-merge Dependabot PRs
check-bot-commits.ymlGuard PRs against bot-authored commits

Composite actions

Actions can be used individually inside your own workflow steps:

yaml
steps:
  - uses: KevinDeBenedetti/github-workflows/.github/actions/setup-node@main
    with:
      node-version: '20'
ActionDescription
setup-nodeInstall Node.js + pnpm/bun with cache
setup-pythonInstall Python + uv with cache
shellcheckRun ShellCheck on all .sh files
batsRun Bats shell unit tests
detect-changesOutput a JSON matrix of changed apps in a monorepo
actionlintValidate GitHub Actions workflow files
kubeconformValidate Kubernetes manifests

Examples

Complete ready-to-use caller files live in examples/:

FileStack
ci-cd-pages.ymlNode.js CI → GitHub Pages → release-please
ci-cd-vercel.ymlNode.js CI → Vercel → release-please
next.ymlNext.js
nuxt.ymlNuxt
vue-react.ymlVue / React (Vite)
fastapi.ymlFastAPI (Python)
monorepo.ymlMonorepo with change detection
maintenance.ymlPurge old deployments and workflow runs