Skip to content

Keep a pull request's own card and milestone in step with its issues - #15

Merged
prabhu merged 1 commit into
mainfrom
project/pr-card-milestone
Oct 30, 2026
Merged

prabhu merged 1 commit into
mainfrom
project/pr-card-milestone

Conversation

@prabhu

@prabhu prabhu commented Oct 30, 2026

Copy link
Copy Markdown
Member

GitHub's built-in project workflows move an issue when a pull request that closes it is opened or merged, but they never touch the pull request's own card, and they never copy the issue's milestone onto the pull request. So cdxgen/cdxgen#4686 sat in Backlog with no milestone while the issue it closes, cdxgen/cdxgen#4605, was already In review and aimed at 13.6.0.

The sync now does both on every pull request event:

  • A pull request without a milestone takes the one the issues it closes agree on. Milestones belong to one repository, so only issues of the pull request's own repository count, and issues aimed at two different milestones give it none.
  • Once a pull request has a milestone, or is already on the board, its card follows the rules the nightly milestoned backfill already uses. A draft is In progress, a ready pull request In review, and a merged one Done. A person's Blocked or a Done the board already has is kept, and a pull request closed without merging is left to the built-in Item closed workflow.
  • The starter also listens for milestoned, so a pull request goes on the board as soon as someone aims it at a release.

The project token need not reach a repository, so the milestone is set with the repository's own token. The starter grants its job pull-requests: write and passes github.token as the new optional REPO_TOKEN secret. The job still runs no code from the pull request. The reusable workflow's own permissions are unchanged, so a repository on an older copy of the starter keeps working and simply leaves milestones alone.

node --test "project/test/*.test.mjs" passes, with 59 tests, 13 of them new, covering the milestone choice, the card rules and the token the milestone is written with. A dry run of sync.mjs against the real cdxgen/cdxgen#4686 and the live board picked milestone 13.6.0 from cdxgen/cdxgen#4605 and left the pull request's card, already In review, alone.

Each calling repository needs to update its copy of the starter to get the milestone part. cdxgen/cdxgen pins this repository by commit, so it needs a follow-up that moves the pin once this merges.

The built-in workflows never move a pull request's card and never copy an
issue's milestone onto the pull request that closes it, so a pull request
sat in Backlog without a milestone while its issue moved to In review. The
sync now gives a pull request the milestone its issues agree on, through
the repository's own token passed as REPO_TOKEN, and moves the pull
request's card by the rules the milestoned backfill uses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-auto A person set the task, and AI agents carried it through to completion enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant