Skip to content

CI hardening: pinned actions and Python, hash-pinned Poetry, lint, Renovate - #166

Merged
Kinflou merged 2 commits into
mainfrom
ci-hardening
Nov 12, 2026
Merged

Kinflou merged 2 commits into
mainfrom
ci-hardening

Conversation

@Kinflou

@Kinflou Kinflou commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Phase 4 of the org CI overhaul for this repo.

What changed

  • Python: every job that runs Python uses actions/setup-python (SHA-pinned) with the exact version 3.14.10, in place of the floating 3.14.
  • Poetry (docs build): pipx install poetry (unpinned) is replaced by pip install --require-hashes --no-deps -r .github/poetry-requirements.txt. That file is poetry 2.3.1 (the version that wrote poetry.lock) and every package it needs, compiled with pip-compile --generate-hashes from .github/poetry-requirements.in. The site's own packages still come from poetry.lock, whose per-file hashes poetry install checks, so the install is hash-pinned end to end. The cache: poetry option of setup-python is dropped: it needs Poetry installed before setup-python runs. The build takes about 30s without it.
  • CLI build in cli-drift and std-drift: the runner's own Rust (whatever its image holds that week) is replaced by dtolnay/rust-toolchain at exactly 1.99.1, the toolchain the CLI pins; it is part of the cache key. The binary is still cargo install --locked --git ... --rev <sha> at the CLI's default-branch tip.
  • Fetching the other repos: none of the checks needs a token. Source files come from raw.githubusercontent.com, git clone/git fetch of public repos, and one gh api call. That call resolved the CLI's default branch with GH_TOKEN: ${{ github.token }}; it is now git ls-remote https://github.com/ComlineProject/cli HEAD, which yields the same commit and needs no token at all.
  • Write scopes: no job in these seven workflows opens an issue or a PR (checked: no gh issue, gh pr, create-PR action or issues:/pull-requests: scope anywhere). Every workflow is contents: read, and the only write scopes are pages: write and id-token: write on the deploy job of docs.yml, as before.
  • Hardening: pinned ubuntu-24.04 (was -latest), timeout-minutes on every job, every action pinned to a 40-hex SHA with a version comment (including actions/cache v4 to v6.1.0 and actions/checkout v7), persist-credentials: false on every checkout (nothing pushes), harden-runner (audit) first in every job, concurrency keyed on workflow and ref.
  • Concurrency: runs cancel only on pull requests. Before, docs.yml had cancel-in-progress: true on every ref, so a second push to main could cancel a run that was deploying to Pages; now a run on main is never cancelled, and its deploy queues.
  • Script injection: none of the workflows interpolates github.event.* into a script; the one ${{ }} that was in a run: (the CLI's commit in --rev) goes through env: now. No pull_request_target or workflow_run triggers.
  • Added lint.yml (the org's reusable lint) and renovate.json: the org preset, plus two rules grouping the poetry lockfile updates and the Poetry tooling requirements into one weekly PR each. Renovate's poetry, pip_requirements and github-actions managers are all on by default in config:recommended, so nothing had to be enabled.
  • Two echo lines in cli-drift.yml and std-drift.yml that held backticks inside single quotes now use double quotes: the new lint (shellcheck through actionlint) flags them (SC2016).

What stayed as it was, and why

  • The scripts and what each drift check compares are untouched, and so are their triggers and schedules.
  • The docs build still runs from poetry.lock; I did not move it to a plain requirements file (see below).
  • Hash-pinned requirements for the whole site build were not done: the docs depend on a local path package (pygments-comline, develop = true), which pip --require-hashes cannot take, and poetry.lock already carries the hashes. Poetry's own requirements file is the one thing pip installs. The drift checks use only the standard library, so they install nothing with pip.
  • docs merges with merge commits; that makes no difference to this draft PR.

Red check that is not from this PR

language-support-drift fails with a 404 on runtime/main/runtime/conformance/features.json: the runtime reorganisation moved that file (to runtime/conformance/spec/features.json), and the script still reads the old path. It was already failing on main (the scheduled run of 2026-11-09). I tried the path-only change locally: it then fails further in, on a feature id (sizes-packed) the reports do not know yet, so it is a content fix to the script and the reports (the downstream path updates tracked in runtime#111) and is left out of this PR.

Only verifiable after merge

  • The real Pages deploy: the build job runs on this PR (it passes), the upload and deploy steps are gated to main, so the first push to main is the first real run. The environment and Pages settings are unchanged.
  • The scheduled runs (daily docs rebuild, weekly drift checks).
  • Renovate's first PRs for .github/poetry-requirements.txt (that it updates the hashes along with the versions).

@Kinflou
Kinflou marked this pull request as ready for review November 12, 2026 01:00
@Kinflou
Kinflou merged commit fd50a9d into main Nov 12, 2026
12 of 13 checks passed
@Kinflou
Kinflou deleted the ci-hardening branch November 12, 2026 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant