# Automate with GitHub Actions — CacheBoost Docs

> Trigger a cache warm after each deployment.

Source: https://www.cache-boost.com/support/guides/automate-with-github-actions.md
Language: en

---



Trigger a cache warm automatically after each deployment using GitHub Actions.

## Prerequisites

- A boost already created via the API or dashboard
- Your site ID and boost ID
- An API key with `boosts:write` scope

## Workflow

Add this workflow to `.github/workflows/warm-cache.yml` in your repository:

```yaml
name: Warm cache

on:
  deployment_status:

jobs:
  warm:
    if: github.event.deployment_status.state == 'success'
    runs-on: ubuntu-latest
    steps:
      - name: Trigger CacheBoost run
        run: |
          curl -sf -X POST \
            https://api.cache-boost.com/v1/sites/${{ vars.CACHEBOOST_SITE_ID }}/boosts/${{ vars.CACHEBOOST_BOOST_ID }}/run \
            -H "Authorization: Bearer ${{ secrets.CACHEBOOST_API_KEY }}"
```

## Configuration

Add the following to your repository (Settings → Secrets and variables → Actions):

| Name | Where | Value |
|------|-------|-------|
| `CACHEBOOST_API_KEY` | Secrets | Your API key (`cb_live_...`) |
| `CACHEBOOST_SITE_ID` | Variables | Your site ID |
| `CACHEBOOST_BOOST_ID` | Variables | Your boost ID |

## Wait for the run to finish

If you want the workflow to wait until the run completes:

```yaml
      - name: Wait for run
        run: |
          RUN_ID=$(curl -sf -X POST \
            https://api.cache-boost.com/v1/sites/${{ vars.CACHEBOOST_SITE_ID }}/boosts/${{ vars.CACHEBOOST_BOOST_ID }}/run \
            -H "Authorization: Bearer ${{ secrets.CACHEBOOST_API_KEY }}" \
            | jq -r '.id')

          for i in $(seq 1 30); do
            STATUS=$(curl -sf \
              https://api.cache-boost.com/v1/runs/$RUN_ID \
              -H "Authorization: Bearer ${{ secrets.CACHEBOOST_API_KEY }}" \
              | jq -r '.status')
            echo "Run status: $STATUS"
            [ "$STATUS" = "done" ] && exit 0
            [ "$STATUS" = "failed" ] && exit 1
            sleep 10
          done
          echo "Timed out waiting for run"
          exit 1
```

> The poll loop above times out after 5 minutes (30 x 10s). Adjust `seq 1 30` and `sleep 10` to match your expected crawl duration.



---

**CacheBoost** — Automatic cache warming for faster websites.

- Website: https://www.cache-boost.com
- Full content (all pages): https://www.cache-boost.com/llms-full.txt
- LLM index: https://www.cache-boost.com/llms.txt
- Documentation: https://www.cache-boost.com/support/getting-started/introduction
- Start free: https://www.cache-boost.com/try
