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
43 changes: 43 additions & 0 deletions .github/code-review/policy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Code review bot, sdk-csharp. Overrides the bot's defaults; anything absent
# keeps the default. See
# MarketData-App/code-review-bot/reviewbot/defaults/policy.yml

# Codex reviews this repository; Claude catches it when Codex cannot.
#
# `fallback`, NOT `first`. Under `first` the run is [ready[0].review(brief)]
# and a BackendError goes straight to _fail -- Claude is never tried, because it
# was dropped into `missing` the moment Codex probed live. Since
# CodexBackend.probe() returns true as soon as $CODEX_HOME/auth.json EXISTS, a
# stale borrowed credential is live-but-broken, and that would end the review
# with a neutral "Bot error" and no comment.
#
# Codex must stay FIRST for a second reason: credential-checkout declines the
# shared credential lease when codex is not the first backend, because a later
# backend is reached rarely or never and holding one plan's lease for it starves
# the repositories that use it on every run.
backends: [codex, claude]
mode: fallback

# The check is advisory until someone adds it to a branch rule, so a blocked
# review costs nothing yet and means something later.
gate: true
require_ci_green: true

# The review rules are in REVIEW.md beside this file. Its two `@include` lines
# pull in the bot's shared rule sets and section 9 describes what the public
# surface is in C#, so there is nothing to add here.

ignore_paths:
- "docs/**"
- "*.md"
- ".github/**/*.md"
- "**/*.lock"
- "**/dist/**"
# Build output. A restored or published tree puts compiled assemblies and
# generated files here, and they would spend the diff budget ahead of the
# source sitting beside them.
- "**/bin/**"
- "**/obj/**"

check_name: "Code review"
timeout_minutes: 15
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Tests

on:
push:
Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/code-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Code review

# DISPATCH ONLY FOR NOW, DELIBERATELY.
#
# The automatic trigger is written out below and commented. It is held back so
# the first review on this repository is read by a person before every open
# pull request gets one: this repository has never been reviewed by the bot, and
# whether the rules say useful things about sdk-csharp is the one thing nobody
# has measured yet.
#
# TO ARM IT: delete the `workflow_run` comment markers below, and delete this
# banner. Nothing else changes. Read docs/setup.md section 4 in
# MarketData-App/code-review-bot first -- it explains why the trigger is CI's
# completion and not the push.
on:
# workflow_run:
# # The `name:` of this repository's pull-request CI, not its filename.
# workflows: ["Tests", "Lint"]
# types: [completed]
issue_comment:
types: [created]
workflow_dispatch:
inputs:
pr:
description: Pull request number
required: true
force:
description: >
Review a commit that has already been reviewed. The bot skips an
unchanged head, so without this a re-dispatch is a no-op that reports
success.
type: boolean
default: false

jobs:
review:
# Guards, each of which cost a failed run elsewhere to learn:
# 1. workflow_run fires for default-branch pushes too, where there is no
# pull request. `workflow_run.event` is what triggered the UPSTREAM
# run, so 'pull_request' is the precise discriminator.
# 2. A comment only starts a review when it is addressed to the bot.
if: >
(github.event_name != 'workflow_run' ||
github.event.workflow_run.event == 'pull_request') &&
(github.event_name != 'issue_comment' ||
(github.event.issue.pull_request != null &&
startsWith(github.event.comment.body, '@marketdata-code-review')))
uses: MarketData-App/code-review-bot/.github/workflows/review.yml@main
# NOT `secrets: inherit`. That only passes secrets to a reusable workflow in
# the SAME organisation. This repository is on the MarketDataApp user account
# and the bot is owned by MarketData-App, so inherit crosses an owner
# boundary and delivers nothing -- the call fails at evaluation naming a
# secret that is sitting in this repository's settings.
secrets:
CODE_REVIEW_APP_PRIVATE_KEY: ${{ secrets.CODE_REVIEW_APP_PRIVATE_KEY }}
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
with:
# REQUIRED: this repository is public and on the MarketDataApp user
# account, so it can never reach the organisation's self-hosted runner --
# that runner group is visibility=all with
# allows_public_repositories=false. A job that asks for it is not refused,
# it queues forever with no runner and nothing saying why.
runs-on: '["ubuntu-latest"]'
# `|| false` is load-bearing: `inputs` exists only for workflow_dispatch,
# and a null against a boolean-typed input fails the ENTIRE workflow at
# evaluation -- no job, no log.
force: ${{ inputs.force || false }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[![Twitter](https://img.shields.io/twitter/follow/MarketDataApp?style=social)](https://twitter.com/MarketDataApp)
[![Helpdesk](https://img.shields.io/badge/Support-Ticketing-ff69b4.svg?logo=TicketTailor&logoColor=white)](https://www.marketdata.app/dashboard/)

[![CI](https://github.com/MarketDataApp/sdk-csharp/actions/workflows/ci.yml/badge.svg)](https://github.com/MarketDataApp/sdk-csharp/actions/workflows/ci.yml)
[![Tests](https://github.com/MarketDataApp/sdk-csharp/actions/workflows/ci.yml/badge.svg)](https://github.com/MarketDataApp/sdk-csharp/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/MarketDataApp/sdk-csharp/graph/badge.svg)](https://codecov.io/gh/MarketDataApp/sdk-csharp)
[![NuGet](https://img.shields.io/nuget/v/MarketDataApp?logo=nuget&label=NuGet)](https://www.nuget.org/packages/MarketDataApp)
[![Downloads](https://img.shields.io/nuget/dt/MarketDataApp?logo=nuget&label=downloads)](https://www.nuget.org/packages/MarketDataApp)
Expand Down