Skip to content

About

Standalone Perforce changelist review bot

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

P4 Review Bot

Standalone Perforce changelist review bot for the Ceramica project.

It polls submitted Perforce changelists, loads deterministic rules from TechDoc.rules.yaml, evaluates them, writes results to review-last.json, and posts Discord notifications.

Features

  • Polls p4 changes -s submitted
  • Reads changelist descriptions, files, and text diffs
  • Loads rules dynamically from rules/TechDoc.rules.yaml
  • Checks submission, naming, and organization rules
  • Posts one Discord message per changelist
  • Mentions the changelist author above their own review embed
  • Uses colored ANSI text for warning/error/blocker findings

Requirements

  • Windows PowerShell 5.1+
  • Perforce p4.exe on PATH
  • Node.js
  • js-yaml available on NODE_PATH or at the path configured in review.config.json

Setup

  1. Copy review.config.example.json to review.config.json.
  2. Copy config/TeamMembers.example.txt to config/TeamMembers.txt.
  3. Fill in your Perforce depot, workspace, user, client, and local tool paths.
  4. Set the Discord webhook URL as an environment variable:
$env:DISCORD_WEBHOOK_URL = "https://discord.com/api/webhooks/..."

Usage

One-shot review:

.\P4Poller.ps1 -Once

Continuous polling:

.\P4Poller.ps1 -LoopSeconds 60

Send results to Discord:

.\P4Poller.ps1 -Once -PostToDiscord

Configuration

The runtime config is review.config.json, which is intentionally ignored by Git.

The committed example is:

review.config.example.json

The team roster is:

config/TeamMembers.txt

This file is also ignored by Git. A sanitized example is committed as:

config/TeamMembers.example.txt

Discord message behavior

  • No warning, error, or blocker: green ✅ success embed with a short summary
  • warning: yellow embed with yellow warning text
  • error: red embed with red error text
  • blocker: red embed with bold red error text
  • info: written to review-last.json but not sent to Discord

Each changelist is posted as its own message. The author mention appears above the embed so the author can quickly find their own entry.

Rules

Rules are defined in:

rules/TechDoc.rules.yaml

Additional project guidance is in:

docs/CeramicaReviewGuidelines.md

Output

Each run writes:

review-last.json

State is stored in:

review.state.json

Delete review.state.json to re-scan all changelists.

About

Standalone Perforce changelist review bot

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages