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
47 changes: 24 additions & 23 deletions .github/workflows/pr-review-security.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
name: PR Review Security

# Automated PR security review via the ci-workflows reusable workflow, the
# security sibling of pr-review.yml. Advisory: never add any check in this
# file to required status checks (github-iac ADR 0011).
# Automated PR security review via the ci-workflows pr-review-cli reusable
# workflow (lane `security`), the security sibling of pr-review.yml. Advisory:
# never add any check in this file to required status checks (github-iac
# ADR 0011).
#
# Repo-local rather than the sync-managed `claude-security-review-caller`
# component (components/claude-lanes/claude-security-review.yml): this
# Repo-local rather than the sync-managed `claude-security-review-hosted-caller`
# component (components/claude-lanes-hosted/claude-security-review.yml): this
# repository is the manifest SOURCE, not a sync target. It tracks that
# component except for the runner note below.
# component except that it passes no `allowed-bot-sender-ids`.
#
# Every non-draft same-repository PR is reviewed; the reusable skips fork PRs
# (they receive no secrets and a read-only token) and every `[bot]` actor.
# Every non-draft same-repository PR is reviewed on GitHub-hosted
# `ubuntu-24.04` (this repository is PUBLIC); the reusable skips fork PRs
# (they receive no secrets and a read-only token), Dependabot, and every
# `[bot]` actor.
#
# NEVER add workflow-level `paths:`/`paths-ignore:`: a check whose workflow
# never triggers stays Pending forever.

on:
pull_request:
# NO `merge_group:`: the pinned action cannot serve that event; see
# NO `merge_group:`: the reusable runs only on `pull_request`; see
# melodic-software/ci-workflows#272 before enabling a merge queue.
types: [opened, synchronize, ready_for_review, reopened]

Expand All @@ -36,23 +39,21 @@ jobs:
# A draft does not spend a review; ready_for_review delivers one.
if: github.event.pull_request.draft == false
permissions:
actions: read # check-key-credit reads its marker; Publish Review reads this workflow's runs
checks: read # Publish Review reads its earlier runs' cost notices
contents: read # checkout + read the diff
pull-requests: write # post the security review + tracking comment
id-token: write # OIDC, mints the Claude GitHub App token (required
# even with an OAuth/API-key credential)
uses: melodic-software/ci-workflows/.github/workflows/pr-review-security.yml@main
pull-requests: write # post the security review, comments, and the lane's reviewed-head marker comment
uses: melodic-software/ci-workflows/.github/workflows/pr-review-cli.yml@main
with:
# Names (never the value) the fallback secret in the lane-outcome record.
fallback-credential-name: FALLBACK_CLAUDE_CODE_OAUTH_TOKEN
# DEVIATION from the component, which names the managed fleet label:
# this repository is PUBLIC, and runner-policy admits a managed label
# only for an enrolled private consumer (`components/runner-policy/README.md`),
# so this caller pins the approved hosted label directly.
runner: ubuntu-24.04
lane: security
publish: comments
docs-only-paths: |
docs/**/*.md
**/README.md
**/CHANGELOG.md
# Pass only the named secrets (least privilege) rather than `secrets:
# inherit`, which would forward every parent secret to the called workflow.
secrets:
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
# The central fallback subscription: the review retries once on it after
# a usage limit on the token above.
CLAUDE_API_KEY: ${{ secrets.REVIEWS_CLAUDE_API_KEY }}
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.REVIEWS_CLAUDE_CODE_OAUTH_TOKEN }}
FALLBACK_CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.FALLBACK_CLAUDE_CODE_OAUTH_TOKEN }}
50 changes: 23 additions & 27 deletions .github/workflows/pr-review.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
name: PR Review

# Automated PR code review via the ci-workflows reusable workflow. The caller
# owns the triggers + GITHUB_TOKEN permission grant (a called workflow can only
# downgrade them, never elevate); the reusable workflow owns the action pin, the
# model, and the secret-handling model.
# Automated PR code review via the ci-workflows pr-review-cli reusable workflow
# (lane `code`). The caller owns the triggers + GITHUB_TOKEN permission grant
# (a called workflow can only downgrade them, never elevate); the reusable
# workflow owns the launcher, the credential order (reviews API key, then
# subscription token, then central fallback), and the secret-handling model.
#
# Repo-local rather than the sync-managed `claude-review-caller` component
# (melodic-software/standards, components/claude-lanes/claude-review.yml): this
# repository is the manifest SOURCE, not a sync target. It tracks that component
# except where a documented constraint forces a deviation — see the trigger,
# concurrency, and runner notes below.
# Repo-local rather than the sync-managed `claude-review-hosted-caller`
# component (melodic-software/standards,
# components/claude-lanes-hosted/claude-review.yml): this repository is the
# manifest SOURCE, not a sync target. It tracks that component except where a
# documented choice differs (this caller passes no `allowed-bot-sender-ids`).
#
# The reusable skips drafts, fork PRs (they receive no secrets and a read-only
# token) and every `[bot]` actor, so none of them is reviewed by design.
# The reusable runs on GitHub-hosted `ubuntu-24.04` (this repository is
# PUBLIC) and skips drafts, fork PRs (they receive no secrets and a read-only
# token), Dependabot, and every `[bot]` actor, so none of them is reviewed by
# design.

on:
pull_request:
# `synchronize` reviews every push, including the push that resolves a
# merge conflict, matching components/claude-lanes/claude-review.yml:
# merge conflict, matching components/claude-lanes-hosted/claude-review.yml:
# GitHub runs no pull_request workflow while a PR conflicts with its base.
#
# Re-running the job does NOT review a newer head: a re-run replays the
Expand Down Expand Up @@ -46,19 +49,14 @@ jobs:
# ready_for_review trigger above is what delivers one when it is ready.
if: github.event.pull_request.draft == false
permissions:
actions: read # check-key-credit reads its marker; Publish Review reads this workflow's runs
checks: read # Publish Review reads its earlier runs' cost notices
contents: read # checkout + read the diff
pull-requests: write # post review + track_progress tracking comment
id-token: write # OIDC — mints the Claude GitHub App token (required
# even with an OAuth/API-key credential)
uses: melodic-software/ci-workflows/.github/workflows/pr-review.yml@main
pull-requests: write # post review, comments, and the lane's reviewed-head marker comment
uses: melodic-software/ci-workflows/.github/workflows/pr-review-cli.yml@main
with:
# Names (never the value) the fallback secret in the lane-outcome record.
fallback-credential-name: FALLBACK_CLAUDE_CODE_OAUTH_TOKEN
# DEVIATION from the component, which names the managed fleet label:
# this repository is PUBLIC, and runner-policy admits a fleet label only
# for an enrolled private consumer (`public-self-hosted-routing`
# otherwise), so this caller pins the approved hosted label directly.
runner: ubuntu-24.04
lane: code
publish: comments
# People whose closing issues the review reads in full, by numeric user
# id: the `human` entries of components/trusted-actors/trusted-actors.json.
# trusted-actors.test.mjs fails when this value, or the one in either
Expand All @@ -70,8 +68,6 @@ jobs:
# Pass only the named secrets (least privilege) rather than `secrets:
# inherit`, which would forward every parent secret to the called workflow.
secrets:
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
# The central fallback subscription: the review retries once on it after
# a usage limit on the token above.
CLAUDE_API_KEY: ${{ secrets.REVIEWS_CLAUDE_API_KEY }}
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.REVIEWS_CLAUDE_CODE_OAUTH_TOKEN }}
FALLBACK_CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.FALLBACK_CLAUDE_CODE_OAUTH_TOKEN }}

67 changes: 31 additions & 36 deletions components/claude-lanes-hosted/claude-review.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,35 @@
name: PR Review Hosted

# SYNC-MANAGED FILE: DO NOT EDIT IN THE CONSUMING REPOSITORY.
# SYNC-MANAGED FILE — DO NOT EDIT IN THE CONSUMING REPOSITORY.
# Source of truth: melodic-software/standards,
# components/claude-lanes-hosted/claude-review.yml (the
# `claude-review-hosted-caller` component in distribution/sync-manifest.yml).
# Downstream edits are overwritten by the next sync PR; change the component
# upstream, or move the component to `locally-owned` in the manifest to
# customize.
#
# Thin caller for the org's reusable code-review lane. The reusable workflow
# owns the action pin, model, and the secret-handling model; per its header,
# this caller owns the triggers, concurrency, and the GITHUB_TOKEN permission
# grant (a called workflow can only downgrade the caller's grant, never
# elevate it).
# Thin caller for the org's pr-review-cli reusable, lane `code`. The reusable
# workflow owns the launcher, the credential order (the reviews role's API key,
# then its subscription token after a handoff, then the central fallback
# subscription), and the secret-handling model; per its header, this caller
# owns the triggers, concurrency, and the GITHUB_TOKEN permission grant (a
# called workflow can only downgrade the caller's grant, never elevate it).
#
# The reusable skips fork PRs (they receive no secrets and a read-only token)
# and every `[bot]` actor whose sender id is not in `allowed-bot-sender-ids`
# (below), so neither is reviewed by design. On a public repository that means
# the lane reviews only pull requests from branches of this repository: fork
# and Dependabot pull requests get no secrets.
# The reusable skips fork PRs (they receive no secrets and a read-only token),
# Dependabot, and every `[bot]` actor whose sender id is not in
# `allowed-bot-sender-ids` (below), so none is reviewed by design. On a public
# repository that means the lane reviews only pull requests from branches of
# this repository: fork and Dependabot pull requests get no secrets.
#
# RUNNER PLACEMENT: hosted shape. This file runs the lane on the GitHub-hosted
# `ubuntu-24.04` runner, which the standards `runner-policy` component admits
# on a public repository. It is the hosted sibling of
# components/claude-lanes/claude-review.yml, which names the private fleet
# review label, and differs from it only in these comments, `runner` and the
# workflow `name:`, which is each file's stem in Title Case. The job id is the same, so
# the check context is the same on every target. A target manages one of the
# two, never both.
#
# INTERIM: this per-visibility pair is removed when the runner choice moves
# inside the ci-workflows reusable and runner-policy gains a cross-repo
# routing kind, so one caller serves both visibilities
# (distribution/sync-manifest.yml, the claude lane caller note).
# RUNNER PLACEMENT: hosted shape. Every job of pr-review-cli.yml runs on
# GitHub-hosted `ubuntu-24.04` (it takes no `runner` input), which the
# standards `runner-policy` component admits on a public repository. It is the
# hosted sibling of components/claude-lanes/claude-review.yml. The workflow
# `name:` is the destination file's stem in Title Case and the job id stays
# `pr-review`; this hosted caller reports `PR Review / Publish Review` (the
# fleet sibling still reports `PR Review / Claude` until private callers
# migrate, and the org's review-lane check lists accept both). A target manages
# one of the two, never both.
#
# This lane is advisory (github-iac ADR 0011: no organization ruleset may make
# an agentic review a merge prerequisite).
Expand Down Expand Up @@ -77,16 +74,14 @@ jobs:
# ready_for_review trigger above is what delivers one when it is ready.
if: github.event.pull_request.draft == false
permissions:
actions: read # check-key-credit reads its marker; Publish Review reads this workflow's runs
checks: read # Publish Review reads its earlier runs' cost notices
contents: read # checkout + read the diff
pull-requests: write # post review, tracking comment and the lane's
# reviewed-head marker comment
id-token: write # OIDC, mints the Claude GitHub App token (required
# even with an OAuth/API-key credential)
uses: melodic-software/ci-workflows/.github/workflows/pr-review.yml@main
pull-requests: write # post review, comments, and the lane's reviewed-head marker comment
uses: melodic-software/ci-workflows/.github/workflows/pr-review-cli.yml@main
with:
# Names (never the value) the fallback secret in the lane-outcome record.
fallback-credential-name: FALLBACK_CLAUDE_CODE_OAUTH_TOKEN
runner: ubuntu-24.04
lane: code
publish: comments
# Bot senders this lane reviews, by numeric user id: the
# automation-lanes App, so a commit it pushes to a pull request is
# reviewed. Where the repository does not set this variable the value is
Expand All @@ -102,9 +97,9 @@ jobs:
allowed-author-ids: '153232337'
# Pass only the named secrets (least privilege) rather than
# `secrets: inherit`, which would forward every parent secret to the
# called workflow.
# called workflow. The reviews role's API key runs first, then its
# subscription token after a handoff, then the central fallback subscription.
secrets:
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
# The central fallback subscription: the review retries once on it after
# a usage limit on the token above.
CLAUDE_API_KEY: ${{ secrets.REVIEWS_CLAUDE_API_KEY }}
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.REVIEWS_CLAUDE_CODE_OAUTH_TOKEN }}
FALLBACK_CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.FALLBACK_CLAUDE_CODE_OAUTH_TOKEN }}
Loading
Loading