From 1c341d58a6ea3f2379e3872d823631fa92ca2a2d Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Mon, 19 Oct 2026 14:23:31 +0200 Subject: [PATCH] CODEOWNERS for the release pipeline, and the protection that makes it count .github/, tools/ci/, the release tools, the signing crate and the code that checks updates are Ludovic's to review. tools/ci/protect_pipeline.sh prints (and with --apply sets) main's protection with code owners' reviews required and no other approvals, keeping the required verify check; it is for the orchestrator to apply once agents work as the GitHub App. Co-Authored-By: Claude Opus 5.5 --- .github/CODEOWNERS | 11 ++++++++++ tools/ci/protect_pipeline.sh | 40 ++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 .github/CODEOWNERS create mode 100755 tools/ci/protect_pipeline.sh diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000..e83b6878c --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,11 @@ +# Changes to these files wait for Ludovic's review once branch protection requires code owners' reviews +# (tools/ci/protect_pipeline.sh, docs/security.md). They are what builds, signs and ships releases, the code that +# checks downloads before installing them, and this file. Everything else merges as soon as `verify` passes. +/.github/ @ludovic111 +/tools/ci/ @ludovic111 +/tools/release_train.py @ludovic111 +/tools/release_channels.py @ludovic111 +/crates/horizon-release-sign/ @ludovic111 +/crates/horizon-server/src/update.rs @ludovic111 +/launcher/src/signed.rs @ludovic111 +/packaging/ @ludovic111 diff --git a/tools/ci/protect_pipeline.sh b/tools/ci/protect_pipeline.sh new file mode 100755 index 000000000..2ed329079 --- /dev/null +++ b/tools/ci/protect_pipeline.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +# Makes main's branch protection require the code owners' review (docs/security.md): a pull request that +# changes a file .github/CODEOWNERS lists waits for Ludovic's approval; every other one still merges as soon as +# `verify` passes (no approvals are required otherwise). Approvals are dismissed by a later push. Everything +# else in the protection (the required `verify` from GitHub Actions, admins included) is kept as it is. +# +# Apply it only once agents open and push pull requests as the horizon-agent GitHub App, not as ludovic111: +# GitHub never counts an author's approval of their own pull request, so until then an agent's change to a +# listed file could not merge at all. +# +# tools/ci/protect_pipeline.sh # print the protection it would set, change nothing +# tools/ci/protect_pipeline.sh --apply # set it (needs the maintainer's admin login) +set -euo pipefail +repo=${GITHUB_REPOSITORY:-ludovic111/horizon} +api="repos/$repo/branches/main/protection" +body=$(gh api "$api" | jq '{ + required_status_checks: (.required_status_checks + | {strict, checks: [.checks[] | {context, app_id}]}), + enforce_admins: .enforce_admins.enabled, + required_pull_request_reviews: { + require_code_owner_reviews: true, + required_approving_review_count: 0, + dismiss_stale_reviews: true, + require_last_push_approval: false + }, + restrictions: null, + required_linear_history: .required_linear_history.enabled, + allow_force_pushes: .allow_force_pushes.enabled, + allow_deletions: .allow_deletions.enabled, + required_conversation_resolution: .required_conversation_resolution.enabled, + lock_branch: .lock_branch.enabled, + allow_fork_syncing: .allow_fork_syncing.enabled +}') +echo "$body" +if [[ "${1:-}" == --apply ]]; then + gh api -X PUT "$api" --input - <<< "$body" > /dev/null + echo "main now requires code owners' reviews." +else + echo "(not applied: run with --apply)" +fi