Skip to content

Add reusable PR Review Tracker workflow#1

Merged
hatton merged 1 commit into
mainfrom
add-pr-review-tracker
Jun 15, 2026
Merged

Add reusable PR Review Tracker workflow#1
hatton merged 1 commit into
mainfrom
add-pr-review-tracker

Conversation

@hatton

@hatton hatton commented Jun 15, 2026

Copy link
Copy Markdown
Member

Adds the shared, reusable workflow that backs the BloomBooks PR Review Tracker org project (#2).

Participating repos forward their pull_request events here via a ~12-line caller (.github/workflows/pr-review.yml) plus secrets: inherit.

Behavior

  • PR opened/reopened → added to the board, Status = Waiting for AI-Review
  • new commit pushed (synchronize) → Status moved back to Waiting for AI-Review

Notes

  • The three project node IDs live here in one place; update them here if the project/Status field is recreated.
  • Requires the org-level PROJECT_TOKEN secret (the default GITHUB_TOKEN can't write org Projects v2).

🤖 Generated with Claude Code

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>
@greptile-apps

greptile-apps Bot commented Jun 15, 2026

Copy link
Copy Markdown

Greptile Summary

This PR introduces a reusable GitHub Actions workflow (pr-review-tracker.yml) that participating repos can call to automatically add PRs to the BloomBooks org project board and set their status to "Waiting for AI-Review" on opened, reopened, and synchronize events.

  • The two-step GraphQL flow (add item → update field value) is correct and the concurrency group properly serialises concurrent pushes to the same PR.
  • The ITEM_ID returned by the first mutation is used directly in the second without a null/empty guard, so a permission error or unexpected API response that still exits 0 would pass "null" as the item ID to the status-update mutation, producing a cryptic failure.
  • The job has no if condition filtering on github.event.action, so callers that accidentally forward closed or other actions would incorrectly flip a merged PR's status back to "Waiting for AI-Review".

Important Files Changed

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"
Comment on lines +56 to +58
echo "Project item: $ITEM_ID"

# Set its Status to "Waiting for AI-Review".

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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.

Suggested change
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".

Comment on lines +32 to +34
jobs:
set-waiting:
runs-on: ubuntu-latest

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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.

Suggested change
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!

@hatton hatton merged commit a6f705c into main Jun 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants