GitHub Secrets Setup

Step-by-step guide to configure GitHub Actions secrets for automated deployment to Cloudflare Pages.

GitHub Actions Secrets Setup

This guide helps you configure the required secrets for automated deployment.

Required Secrets

1. CLOUDFLARE_API_TOKEN

Purpose: Allows GitHub Actions to deploy to Cloudflare Pages

How to Create:

  1. Go to Cloudflare Dashboard
  2. Click “Create Token”
  3. Use “Custom token” template
  4. Configure:
    Token name: "GitHub Actions - LATTS Docs"
    Permissions:
      - Account:Cloudflare Pages:Edit
      - Zone:Zone:Read  
      - Zone:Page Rules:Edit
    Account resources: Include - Your Account
    Zone resources: Include - latts.ie (or your domain)
    
  5. Click “Continue to summary”“Create Token”
  6. Copy the token (you won’t see it again!)

2. CLOUDFLARE_ACCOUNT_ID

Purpose: Identifies your Cloudflare account for deployment

How to Find:

  1. Go to Cloudflare Dashboard
  2. Look in the right sidebar under “Account ID”
  3. Copy the ID (format: 1234567890abcdef1234567890abcdef)

Adding Secrets to GitHub

  1. Navigate to Repository Settings

    GitHub  latts-ie/wiki-internal  Settings  Secrets and variables  Actions
    
  2. Add Each Secret

    • Click “New repository secret”

    • Name: CLOUDFLARE_API_TOKEN

    • Value: [paste your API token]

    • Click “Add secret”

    • Click “New repository secret”

    • Name: CLOUDFLARE_ACCOUNT_ID

    • Value: [paste your account ID]

    • Click “Add secret”

Verification

Once secrets are added, the GitHub Actions workflow will:

  • ✅ Deploy to production on pushes to main branch
  • ✅ Deploy preview versions for pull requests
  • ✅ Run automated tests before deployment
  • ✅ Comment on PRs with preview URLs

Security Notes

  • API tokens are encrypted and only accessible to GitHub Actions
  • Tokens can be revoked/regenerated at any time in Cloudflare
  • Regular token rotation is recommended (every 90 days)

Next Steps

After adding secrets:

  1. Push changes to trigger first automated deployment
  2. Create a test PR to verify preview deployments work
  3. Monitor GitHub Actions tab for deployment status
Last modified July 29, 2025: fixed docsy,hugo and cf deploy (0c29dc0)