Add reusable PR Review Tracker workflow#1
Conversation
Centralizes automation for the BloomBooks PR Review Tracker org project (#2). Repos call this via a thin pull_request caller and secrets: inherit. On PR opened/reopened or a new commit (synchronize), the PR is added to the board and its Status set to Waiting for AI-Review. Project node IDs live here in one place. Requires an org-level PROJECT_TOKEN secret (default GITHUB_TOKEN cannot write org Projects). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
| Filename | Overview |
|---|---|
| .github/workflows/pr-review-tracker.yml | New reusable workflow that adds PRs to a GitHub Projects v2 board and sets their status; missing an ITEM_ID null-check that could silently pass an invalid ID to the second mutation, and no job-level guard against unexpected pull_request event actions. |
Reviews (1): Last reviewed commit: "Add reusable PR Review Tracker workflow" | Re-trigger Greptile
There was a problem hiding this comment.
Pull request overview
Adds a reusable GitHub Actions workflow to centralize automation for the BloomBooks “PR Review Tracker” org Project v2, so participating repositories can forward pull_request events to a single implementation.
Changes:
- Introduces a
workflow_call-based reusable workflow that adds a PR to the org project and sets the Project “Status” field to Waiting for AI-Review. - Adds concurrency controls to ensure only one tracker run per PR is active at a time.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # | ||
| # Rules implemented: | ||
| # - PR opened/reopened -> add to the project, Status = "Waiting for AI-Review" | ||
| # - new commit pushed (pull_request `synchronize`) -> Status back to "Waiting" |
| echo "Project item: $ITEM_ID" | ||
|
|
||
| # Set its Status to "Waiting for AI-Review". |
There was a problem hiding this comment.
If
addProjectV2ItemById succeeds at the HTTP level but returns null for item (e.g., the PR's content node belongs to a different org, or the project is archived), --jq emits the literal string "null". set -euo pipefail won't catch this because the gh command exited 0. The subsequent updateProjectV2ItemFieldValue call then sends itemId: "null" to GraphQL and will either fail with a cryptic error or silently no-op, making the status never get set while the workflow still reports success.
| echo "Project item: $ITEM_ID" | |
| # Set its Status to "Waiting for AI-Review". | |
| echo "Project item: $ITEM_ID" | |
| [[ -n "$ITEM_ID" && "$ITEM_ID" != "null" ]] \ | |
| || { echo "::error::addProjectV2ItemById returned no item id — check PROJECT_TOKEN permissions and project membership"; exit 1; } | |
| # Set its Status to "Waiting for AI-Review". |
| jobs: | ||
| set-waiting: | ||
| runs-on: ubuntu-latest |
There was a problem hiding this comment.
The job has no guard on
github.event.action, so if a caller accidentally forwards a closed, labeled, or other pull_request action, this workflow will reset the board status back to "Waiting for AI-Review" on a closed/merged PR. Adding an explicit if condition makes the reusable workflow self-protecting regardless of what the caller passes through.
| jobs: | |
| set-waiting: | |
| runs-on: ubuntu-latest | |
| jobs: | |
| set-waiting: | |
| if: contains(fromJSON('["opened", "reopened", "synchronize"]'), github.event.action) | |
| runs-on: ubuntu-latest |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Adds the shared, reusable workflow that backs the BloomBooks PR Review Tracker org project (#2).
Participating repos forward their
pull_requestevents here via a ~12-line caller (.github/workflows/pr-review.yml) plussecrets: inherit.Behavior
opened/reopened→ added to the board, Status = Waiting for AI-Reviewsynchronize) → Status moved back to Waiting for AI-ReviewNotes
PROJECT_TOKENsecret (the defaultGITHUB_TOKENcan't write org Projects v2).🤖 Generated with Claude Code