Skip to content

Automate priority sync between Project board field and P0/P1/P2 labels #2331

Description

@leofang

Summary

Priority is currently tracked in two independent places:

  • Repo labels: P0 / P1 / P2
  • Project 41 custom "Priority" single-select field (values P0 / P1 / P2)

These are set independently and drift out of sync over time. Proposal: add a scheduled workflow that treats the Project field as source of truth and mirrors it to the repo label, so that the label search (is:issue label:P0) stays accurate for CLI / API / RSS consumers.

Context — current drift

An audit turned up 25 open issues currently out of sync:

Hard mismatches (label ≠ project priority):

Label but no project entry:

Project priority set but no label (dominant failure mode):

The 19 label-missing cases mean the current label search silently under-counts open P0/P1 work.

Proposed automation

Add a new scheduled workflow under .github/workflows/ (e.g. priority-sync.yml), cron every 15–30 min plus workflow_dispatch:

  1. GraphQL query enumerates Project 41 items scoped to NVIDIA/cuda-python.
  2. For each item, read the Priority custom field.
  3. On the linked issue/PR, remove any stale P* label and add the correct one. No-op when already in sync.

Auth: fine-grained PAT with project:read + issues:write (default GITHUB_TOKEN cannot access org-level Projects v2). Stored as a repo secret; ownership documented in the workflow header.

Optional companion (label → project): trigger on issues.labeled / unlabeled where the label matches ^P[0-2]$; GraphQL mutation writes the project field. Closes the reverse-drift case where a triager sets the label but forgets the board.

Gotchas / notes

  • Projects v2 webhook events (projects_v2_item.edited) are not triggerable from a workflow on: block; event-driven sync from the project side would need a GitHub App or external listener. Cron polling side-steps this.
  • If Project 41 contains items from other repos, the sync must scope to NVIDIA/cuda-python explicitly to avoid cross-repo label bleed.
  • Brief inconsistency window on newly-triaged issues, bounded by the cron interval.

Alternative on the table

Drop the P* labels entirely and standardize on the Project field. Simpler operationally (no workflow, no PAT to rotate) but loses is:issue label:P0, gh issue list --label P0, and RSS filters — searchers would go through the project board or a gh api graphql snippet. Leaving on the table for discussion.

Backfill

Once direction is settled, the 25 mismatches above can be corrected by hand or via a one-shot script.

-- Leo's bot

Metadata

Metadata

Assignees

Labels

CI/CDCI/CD infrastructureP0High priority - Must do!

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions