Repository navigation
ci(project): nightly drift-sync to catch missed auto-adds - #2316
Conversation
Adds a scheduled safety net behind the event-driven add-to-project workflows. Every day at 03:00 UTC, reconciles the FastLED Tracker project (#1) against the live state of the six feeder repos and adds any open issue/PR that isn't already linked. Also exposed via workflow_dispatch with an `include_closed` flag for rare full-backfill needs (off by default — there are ~1500 historical closed items). Why: event-driven workflows miss items if a run flakes, if the App key is revoked mid-day, if events aren't delivered (rare but documented), or if automation was off entirely for a window. Without a reconciler, those items drift forever. This script finds them on the next cron. Design notes: - addProjectV2ItemById is idempotent — re-adds cost nothing. - Script first fetches every item currently in the project (paginated GraphQL), then per-repo diffs against gh issue/pr list output, then adds missing items one-by-one. Rate-limit friendly: one mutation per missing item, which is typically 0-5 per day. - Uses the same GitHub App installation token as project_automation.yml, so no additional secrets. - Smoke-tested locally: 293 project items, 277 open items across 6 repos, 1 missing → added cleanly. On "bot resurrection": if the App key gets rotated wrong, or a workflow disables, or anything else drops coverage, the next scheduled run backfills whatever was missed while things were broken. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughA new GitHub Actions workflow and Python script add nightly drift synchronization for GitHub Projects. The workflow triggers automatically at 03:00 UTC or manually, executing a script that resolves a project's node ID, fetches current linked items, iterates through configured feeder repositories, and adds any missing items to the project. Changes
Sequence DiagramsequenceDiagram
actor Schedule as GitHub<br/>(Schedule/Manual)
participant Workflow as GitHub Actions<br/>Workflow
participant Script as Drift Sync<br/>Script
participant GH as GitHub API<br/>(gh CLI)
participant Repos as Feeder<br/>Repositories
Schedule->>Workflow: Trigger (nightly or manual)
Workflow->>Workflow: Checkout & setup Python 3.11
Workflow->>GH: Create GitHub App token
Workflow->>Script: Execute with env vars
Script->>GH: Resolve project node ID
GH-->>Script: Project node ID
Script->>GH: Fetch current project items
GH-->>Script: Item list (repo, number)
Script->>Repos: List issues/PRs for each repo
Repos-->>Script: Item node IDs & numbers
Script->>Script: Identify missing items
alt For each missing item
Script->>GH: addProjectV2ItemById (GraphQL)
GH-->>Script: Success or failure
end
Script->>Workflow: Exit code (0 or 1)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Adds a daily cron + workflow_dispatch reconciler. Safety net behind the event-driven auto-add workflows. Smoke-tested locally (added 1 drifted item). Uses the same GitHub App as project_automation.yml.
Summary by CodeRabbit