Skip to content

namespace.validate lists the token edits a followed rename allows in each memory, or why none is offered #4505

namespace.validate lists the token edits a followed rename allows in each memory, or why none is offered

namespace.validate lists the token edits a followed rename allows in each memory, or why none is offered #4505

Workflow file for this run

name: docs site
# Publishes legacy redirects and submits changed site URLs after production deploys.
on:
push:
branches: [main]
pull_request:
branches: [main]
paths:
- "docs/**"
- "i18n/**"
- "mkdocs.yml"
- "llms.txt"
- "llms-install.md"
- "scripts/docs_site/**"
- "scripts/codegen/page_summary.py"
- ".github/workflows/docs-site.yml"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build:
name: build
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
pages: read # Read the base URL used by the legacy Markdown copies.
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: "3.12"
- name: Install the site builder
run: |
python -m pip install --require-hashes --no-deps --only-binary=:all: -r scripts/docs_site/requirements.txt
- if: github.ref == 'refs/heads/main' && vars.DOCS_SITE_ENABLED == 'true'
name: Read the legacy Pages URL
id: pages
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
- name: Build legacy documentation redirects
env:
LOOM_LEGACY_DOCS_URL: ${{ steps.pages.outputs.base_url || 'https://loom.clickhouse.com/docs' }}/
run: |
mkdocs build --strict
python -m scripts.docs_site.redirect_pages site "$LOOM_LEGACY_DOCS_URL"
- if: github.event_name != 'pull_request'
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: site
deploy:
name: deploy
if: github.ref == 'refs/heads/main' && vars.DOCS_SITE_ENABLED == 'true'
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
pages: write # Deploy the built Pages artifact.
id-token: write # Authenticate the Pages deployment.
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1
indexnow:
name: indexnow
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
timeout-minutes: 8
permissions:
contents: read
actions: read # Find an earlier submission that succeeded.
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: "3.12"
- name: Submit changed pages after the production deployment
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
# Legacy redirect publication has its own result. Only a successful IndexNow
# job advances the comparison point so the next run covers a failed submission.
base=
page=1
while [[ -z "$base" ]]; do
runs=$(gh api "repos/$GITHUB_REPOSITORY/actions/workflows/docs-site.yml/runs?branch=main&status=completed&per_page=25&page=$page" \
--jq '.workflow_runs[] | [.id, .head_sha] | @tsv')
if [[ -z "$runs" ]]; then break; fi
while IFS=$'\t' read -r run commit; do
if ! git merge-base --is-ancestor "$commit" HEAD; then continue; fi
submitted=$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$run/jobs" \
--jq 'any(.jobs[]; .name == "indexnow" and .conclusion == "success")')
if [[ "$submitted" == true ]]; then
base="$commit"
break
fi
done <<< "$runs"
page=$((page + 1))
done
changed="$RUNNER_TEMP/indexnow-changes"
if [[ -n "$base" ]]; then
git diff -z --name-status --no-renames "$base" HEAD > "$changed"
else
# Without a recent checkpoint, submit the canonical site as a single batch.
printf '%s\0' M docs/blume.config.ts > "$changed"
fi
routes=docs/scripts/public-pages.json
previous_routes="$RUNNER_TEMP/indexnow-previous-public-pages.json"
if [[ -n "$base" ]] && git cat-file -e "$base:$routes" 2>/dev/null; then
git show "$base:$routes" > "$previous_routes"
else
printf '{}\n' > "$previous_routes"
fi
urls=$(python scripts/docs_site/indexnow.py --list --previous-public-pages "$previous_routes" --changes-file "$changed")
if [[ -z "$urls" ]]; then
echo 'indexnow: no public page changed'
exit 0
fi
# Read the revision from the live site. Preview and production deployments
# share the same GitHub commit status.
for attempt in {1..25}; do
deployed=$(curl -fsS --max-time 4 \
"https://loom.clickhouse.com/.well-known/loom-revision.txt?commit=$GITHUB_SHA&attempt=$attempt") || deployed=
if [[ "$deployed" == "$GITHUB_SHA" ]]; then
python scripts/docs_site/indexnow.py --previous-public-pages "$previous_routes" --changes-file "$changed"
exit 0
fi
sleep 10
done
echo 'indexnow: production deployment was not confirmed' >&2
exit 1