From 269a49c13ddb6ee46cc8b0149a4db2104b831119 Mon Sep 17 00:00:00 2001 From: Marcin Polewski Date: Sat, 21 Nov 2026 16:38:14 +0000 Subject: [PATCH 1/2] Pin this repository's review to NCode Review v1.5.0 and pass the approver's key --- .github/workflows/code-review.yml | 18 ++++++++++++------ CHANGELOG.md | 4 ++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/code-review.yml b/.github/workflows/code-review.yml index bf271a06..293ad59a 100644 --- a/.github/workflows/code-review.yml +++ b/.github/workflows/code-review.yml @@ -13,10 +13,13 @@ name: Code review # is an organization secret, and the code-review environment holds none; it only lets Anthropic's federation rule trust # the review job. # -# approve: true (v1.4.0 on) approves a pull request whose review leaves no blocker or should-fix finding open; -# tools/Set-RepositoryBaseline.ps1 in the project template then requires one approval. A push dismisses it, so comment -# /review after one; a maintainer approves a bot's pull request, which NCode Review skips. -# docs/decisions/project-template/0022-ncode-reviews-approval-gates-the-merge.md says why. +# approve: true approves a pull request whose review leaves no blocker or should-fix finding open. With +# approver-private-key (v1.5.0 on), the NCode Review Approver, an app that can write, submits that approval, so it meets +# the ruleset's required approval; tools/Enable-CodeReview.ps1 -ApproverPrivateKeyPath stores its key in the code-review +# environment, and tools/Set-RepositoryBaseline.ps1 in the project template then requires one approval, of the last +# push. A push dismisses it, so comment /review after one; a maintainer approves a bot's pull request, which NCode Review +# skips. docs/decisions/1011-the-approval-is-submitted-by-an-approver-app-that-can-write.md and the project template's +# ADR-0022 and ADR-0036 say why. # # pull_request_target and issue_comment both run this file from the default branch, so a pull request can't change its # own review. The engine fetches its code only to read it: nothing from it is built, run or installed. @@ -77,12 +80,15 @@ jobs: persist-credentials: false - name: Review - uses: NCodeGroup/code-review@da82720a1fb582551e8d460ddd277f3cdc8b43f1 # v1.4.2 + uses: NCodeGroup/code-review@a4cdf65d2450e4e1b2b92ed53430ceb8026d4f97 # v1.5.0 with: app-private-key: ${{ secrets.NCODE_REVIEW_APP_PRIVATE_KEY }} bedrock-api-key: ${{ secrets.AWS_BEARER_TOKEN_BEDROCK }} # A review that leaves no blocker or should-fix finding open approves the pull request. approve: true + # The NCode Review Approver submits the approval, so it meets the ruleset's required approval; the key is a + # secret of the code-review environment, which only the default branch can deploy to. + approver-private-key: ${{ secrets.NCODE_REVIEW_APPROVER_PRIVATE_KEY }} outcomes: # A closed pull request, merged or not, whoever closed it (a merge queue merges as a bot) and whatever its labels: @@ -102,6 +108,6 @@ jobs: pull-requests: read steps: - name: Record the outcomes - uses: NCodeGroup/code-review@da82720a1fb582551e8d460ddd277f3cdc8b43f1 # v1.4.2 + uses: NCodeGroup/code-review@a4cdf65d2450e4e1b2b92ed53430ceb8026d4f97 # v1.5.0 with: app-private-key: ${{ secrets.NCODE_REVIEW_APP_PRIVATE_KEY }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 590d269f..6304050f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), ## [Unreleased] +### Changed + +- This repository's own review pins NCode Review v1.5.0 and passes `approver-private-key` from its `code-review` environment, so the NCode Review Approver submits the approval of a clean review ([#234](https://github.com/NCodeGroup/code-review/issues/234), [ADR-1011](docs/decisions/1011-the-approval-is-submitted-by-an-approver-app-that-can-write.md)). + ## [1.5.0] - 2026-11-21 ### Added From 02d67ce8def71e54288af65c824ffd1fcbd11e9e Mon Sep 17 00:00:00 2001 From: Marcin Polewski Date: Sat, 21 Nov 2026 16:41:41 +0000 Subject: [PATCH 2/2] Say that the code-review environment holds the approver's key --- .github/workflows/code-review.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/code-review.yml b/.github/workflows/code-review.yml index 293ad59a..db252e6d 100644 --- a/.github/workflows/code-review.yml +++ b/.github/workflows/code-review.yml @@ -9,17 +9,18 @@ name: Code review # Review sets aside; `/review explain F3` says whether a finding still holds, and `/review teach ` files a rule as # an issue, both on a closed pull request too. A `skip-review` label skips the automatic reviews. When a pull request # closes, merged or not, the outcomes job records what became of each finding (fixed, dismissed, acknowledged or -# ignored) in the summary comment, by rules alone: no review and no model call. It needs no environment: the app's key -# is an organization secret, and the code-review environment holds none; it only lets Anthropic's federation rule trust -# the review job. +# ignored) in the summary comment, by rules alone: no review and no model call. It needs no environment: the NCode +# Review app's key is an organization secret. The code-review environment, which only the default branch can deploy +# to, holds the approver's key, NCODE_REVIEW_APPROVER_PRIVATE_KEY, once it is stored, and lets Anthropic's federation +# rule trust the review job. # # approve: true approves a pull request whose review leaves no blocker or should-fix finding open. With # approver-private-key (v1.5.0 on), the NCode Review Approver, an app that can write, submits that approval, so it meets # the ruleset's required approval; tools/Enable-CodeReview.ps1 -ApproverPrivateKeyPath stores its key in the code-review # environment, and tools/Set-RepositoryBaseline.ps1 in the project template then requires one approval, of the last -# push. A push dismisses it, so comment /review after one; a maintainer approves a bot's pull request, which NCode Review -# skips. docs/decisions/1011-the-approval-is-submitted-by-an-approver-app-that-can-write.md and the project template's -# ADR-0022 and ADR-0036 say why. +# push. A push dismisses it, so comment /review after one; a maintainer approves a bot's pull request, which NCode +# Review skips. docs/decisions/1011-the-approval-is-submitted-by-an-approver-app-that-can-write.md and the project +# template's ADR-0022 and ADR-0036 say why. # # pull_request_target and issue_comment both run this file from the default branch, so a pull request can't change its # own review. The engine fetches its code only to read it: nothing from it is built, run or installed. @@ -30,7 +31,7 @@ name: Code review # extended suite flags any other). Dependabot's github-actions entry opens each bump and updates the SHA and the tag. # Run tools/Enable-CodeReview.ps1 from a clone of NCodeGroup/code-review once for this repository: it creates the # code-review environment, which only the default branch can deploy to, and gives the repository access to the -# organization's two secrets. +# organization's two secrets; -ApproverPrivateKeyPath stores the approver's key in that environment. on: pull_request_target: