Files
datastore/ci/workflows/nightly_docs_autogen.py
Shaun StruwigandClaude Opus 4.8 8771996f74 Address review feedback on the nightly docs-autogen workflow
Three fixes for https://github.com/ClickHouse/ClickHouse/pull/109746:

- Run the job directly on the runner instead of in `clickhouse/docs-builder`.
  The generator only needs `python3` and the built `clickhouse` binary, and
  the pull-request management needs `gh`; all three are on the runner, which
  is where the other `enable_gh_auth` jobs already run. The docs-builder image
  has no `gh`, so the previous configuration would have failed at PR time (and
  at `gh auth` time). This avoids adding `gh` to a shared docs image.

- Do not manage the `pr-autogenerated-docs` label from the workflow. The label
  is provisioned once in the repository as part of the rollout, so the workflow
  only attaches it and the repository stays the single source of truth for its
  color and description.

- Reconcile the no-diff path. When regeneration produces no changes but a stale
  bot pull request is still open (the same regeneration was merged manually, or
  a later source change made the tree match master again), close it and delete
  its branch instead of leaving it advertising outdated changes.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-07-08 16:25:00 +02:00

53 lines
1.5 KiB
Python

from praktika import Job, Workflow
from ci.defs.defs import (
BASE_BRANCH,
DOCKERS,
SECRETS,
ArtifactConfigs,
ArtifactNames,
RunnerLabels,
)
from ci.defs.job_configs import JobConfigs
# Reuse the regular ARM binary build so the generator queries `system.documentation`
# from a fresh master binary.
arm_binary_build = next(
job for job in JobConfigs.build_jobs if ArtifactNames.CH_ARM_BINARY in job.provides
)
# Runs directly on the runner (no container), matching the other `enable_gh_auth`
# jobs: the generator only needs python3 and the built `clickhouse` binary, and
# the pull-request management needs `gh`, which the runner provides. `enable_gh_auth`
# supplies the GitHub App token used to push the branch and open the pull request.
# Requiring the artifact orders it after the build.
docs_autogen_job = Job.Config(
name="Docs autogenerate",
runs_on=RunnerLabels.FUNC_TESTER_ARM,
command="python3 ./ci/jobs/docs_autogen_nightly.py",
requires=[ArtifactNames.CH_ARM_BINARY],
enable_gh_auth=True,
)
workflow = Workflow.Config(
name="NightlyDocsAutogenerate",
event=Workflow.Event.SCHEDULE,
branches=[BASE_BRANCH],
jobs=[
arm_binary_build,
docs_autogen_job,
],
dockers=DOCKERS,
secrets=SECRETS,
artifacts=[
*ArtifactConfigs.clickhouse_binaries,
],
enable_report=True,
enable_cidb=False,
cron_schedules=["13 7 * * *"], # off-peak, distinct from the other nightlies
)
WORKFLOWS = [
workflow,
]