Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),

## [Unreleased]

### Added

- `docs/setup.md` is the runbook that sets NCode Review up end to end: once per organization (gh's scopes, the NCode Review and NCode Review Approver apps, Anthropic's workload identity federation and the organization secrets), once per repository (the approver's installation and key, `code-review.yml`'s approval inputs, requiring the approval and checking it), the private keys, how a review behaves, and the errors met so far with their fixes; `README.md` and `docs/README.md` link it ([#237](https://github.com/NCodeGroup/code-review/issues/237)).

### Changed

- The README's Using it caller pins NCode Review v1.5.0 and passes `approve: true` and `approver-private-key` in its review job, and the Interface's list of what a caller needs names the optional `NCODE_REVIEW_APPROVER_PRIVATE_KEY` environment secret ([#237](https://github.com/NCodeGroup/code-review/issues/237)).
- 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)).
- The project follows project-template v0.111.1: the new `/run-issues-all-in` command for Claude Code, Copilot Chat and Copilot CLI runs `/run-issues` with its answers given and its caps lifted ([project-template ADR-0033](docs/decisions/project-template/0033-an-all-in-run-lifts-the-autopilots-limits-on-the-maintainers-word.md)); the workflow commands, `/best-practices`, the file-header check, `code-review-auto-merge.yml` and the template's decision records are refreshed, with [project-template ADR-0034](docs/decisions/project-template/0034-with-one-writer-the-baseline-requires-no-approval.md), [project-template ADR-0035](docs/decisions/project-template/0035-a-sole-maintainer-dismisses-the-scorecard-alerts-one-person-cannot-clear.md) and [project-template ADR-0036](docs/decisions/project-template/0036-a-required-approval-is-met-by-ncode-reviews-approver-app.md) on required approvals and Scorecard alerts; and `AGENTS.md` and `GOVERNANCE.md` say that the NCode Review Approver's approval meets the ruleset's required approval here.

Expand Down
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ A [re-review](#re-reviews) runs only its own reviewers and prompt, so it runs no

## Using it

To set NCode Review up for an organization or a repository, follow [docs/setup.md](docs/setup.md), the runbook that orders these steps; this README is their reference.

```yaml
name: Code review
on:
Expand Down Expand Up @@ -141,10 +143,15 @@ jobs:
with:
path: base
persist-credentials: false
- uses: NCodeGroup/code-review@d14405f82771819586a5ccbff636929dc894b780 # v1.0.0
- 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:
Expand All @@ -164,7 +171,7 @@ jobs:
pull-requests: read
steps:
- name: Record the outcomes
uses: NCodeGroup/code-review@d14405f82771819586a5ccbff636929dc894b780 # v1.0.0
uses: NCodeGroup/code-review@a4cdf65d2450e4e1b2b92ed53430ceb8026d4f97 # v1.5.0
with:
app-private-key: ${{ secrets.NCODE_REVIEW_APP_PRIVATE_KEY }}
```
Expand Down Expand Up @@ -214,7 +221,8 @@ The action has no outputs. A caller needs:
with the type `created`;
- a `review` job with `environment: code-review`, the permissions `id-token: write`, `contents: read`, `issues: read`
and `pull-requests: read`, the default branch checked out into `base` with `persist-credentials: false`, and the
secrets `NCODE_REVIEW_APP_PRIVATE_KEY` and `AWS_BEARER_TOKEN_BEDROCK`;
secrets `NCODE_REVIEW_APP_PRIVATE_KEY` and `AWS_BEARER_TOKEN_BEDROCK`, plus, to approve as the NCode Review
Approver, the `code-review` environment's secret `NCODE_REVIEW_APPROVER_PRIVATE_KEY`;
- an `outcomes` job with no environment, the permissions `contents: read` and `pull-requests: read`, no checkout, and
the secret `NCODE_REVIEW_APP_PRIVATE_KEY`;
- a Linux runner for both, such as `ubuntu-latest`.
Expand Down Expand Up @@ -627,6 +635,8 @@ key). Anthropic needs no secret, because the workflow logs in through workload i
setting and changing which repositories can read organization secrets needs gh's `admin:org` scope:
`gh auth refresh -h github.com -s admin:org`.

[docs/setup.md](docs/setup.md) gives every step in order, with what to check and what goes wrong; this section and [Approvals](#approvals) are their reference.

From a clone of this repository:

```powershell
Expand All @@ -639,6 +649,9 @@ pwsh -File .\tools\Enable-CodeReview.ps1 -Repo identity-platform,Identity
# Opt in without prompting for or setting the Bedrock key; the repositories still get access to the existing one.
.\tools\Enable-CodeReview.ps1 -Repo identity-platform -SkipBedrock

# Store the NCode Review Approver's key in each repository's code-review environment, and add it to the approver's installation.
.\tools\Enable-CodeReview.ps1 -Repo identity-platform -ApproverPrivateKeyPath <path to the NCode Review Approver .pem>

# Set or replace the app key, or the Bedrock key (from AWS_BEARER_TOKEN_BEDROCK, or a hidden prompt).
.\tools\Enable-CodeReview.ps1 -AppPrivateKeyPath <path to the NCode Review .pem>
.\tools\Enable-CodeReview.ps1 -UpdateBedrockKey
Expand Down
2 changes: 2 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ offers. Every document in `docs/` has a line here.
for registering at bestpractices.dev.
- [best-practices-criteria.md](best-practices-criteria.md): every OpenSSF Best Practices criterion of the three levels,
with the answer to expect, its evidence and the prompt that registers the project; the template owns it.
- [setup.md](setup.md): the runbook that sets NCode Review up for the organization and for each repository, top to
bottom, with its troubleshooting.
- [decisions/](decisions/README.md): architecture decision records, one short file per decision, with the project
template's own decisions in [decisions/project-template/](decisions/project-template/README.md).
- [designs/](designs/_template.md): design documents for work bigger than one plan, started from
Expand Down
Loading
Loading