Skip to content

IndexNow with GitHub Actions

Automate delta-only IndexNow URL submissions after production deploys using GitHub Actions and repository secrets.

Design rules for CI/CD submissions

Store the key in GitHub Secrets
Add INDEXNOW_KEY under Settings -> Secrets and variables -> Actions so workflow logs mask the value automatically.
Wait until production is live
Trigger IndexNow after your hosting deploy finishes (for example via deployment_status or after a deploy step) so crawlers never hit stale pages or a missing key file.
Submit only recently modified URLs
Filter your live sitemap by lastmod (e.g. last 24 hours) or diff against the previous release instead of pushing your entire sitemap on every commit.

Workflow example using submitnow CLI

You can submit recently updated URLs straight from your live sitemap using Node 22+ and the zero-dependency CLI included in the submitnow repository, or call api.indexnow.org directly with curl.

name: Notify IndexNow after deploy

on:
  workflow_dispatch:
  push:
    branches: [main]

jobs:
  indexnow:
    runs-on: ubuntu-latest
    steps:
      - name: Check key file and submit recent sitemap URLs
        env:
          INDEXNOW_KEY: ${{ secrets.INDEXNOW_KEY }}
        run: |
          curl --fail --silent "https://www.example.com/${INDEXNOW_KEY}.txt" | grep -qx "${INDEXNOW_KEY}"
          curl --fail-with-body -X POST "https://api.indexnow.org/indexnow" \
            -H "Content-Type: application/json; charset=utf-8" \
            -d "{\"host\":\"www.example.com\",\"key\":\"${INDEXNOW_KEY}\",\"keyLocation\":\"https://www.example.com/${INDEXNOW_KEY}.txt\",\"urlList\":[\"https://www.example.com/\"]}"