Skip to main content
Automate content deployment by running validation on pull requests and pushing on merge to main. This enables a content-as-code workflow where changes are reviewed in PRs before going live.

GitHub Actions workflow

.github/workflows/help-center.yml
name: Help Center Content

on:
  pull_request:
    paths:
      - 'docs/**'
      - 'opencx.toml'
  push:
    branches: [main]
    paths:
      - 'docs/**'
      - 'opencx.toml'

jobs:
  gate:
    name: Validate content
    runs-on: ubuntu-latest
    if: github.event_name == 'pull_request'
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - run: npx @opencx/cli content gate
        env:
          OPENCX_API_KEY: ${{ secrets.OPENCX_API_KEY }}

  deploy:
    name: Push content
    runs-on: ubuntu-latest
    if: github.ref == 'refs/heads/main' && github.event_name == 'push'
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - run: npx @opencx/cli content push --yes
        env:
          OPENCX_API_KEY: ${{ secrets.OPENCX_API_KEY }}

Environment variables

VariableRequiredDescription
OPENCX_API_KEYYesAPI key for authentication
Never commit API keys to your repository. Use GitHub Secrets or your CI provider’s secret management.

How it works

  1. On pull requests: content gate validates content and checks for drift. If validation fails, the PR check fails.
  2. On merge to main: content push --yes pushes content to your help center without prompts.