Skip to content

Build/Test Tools: Match raw PR body when closing PRs for fixed Trac tickets - #13153

Open
irozum wants to merge 1 commit into
WordPress:trunkfrom
irozum:task/65892-cleanup-pr-search-not-matching
Open

Build/Test Tools: Match raw PR body when closing PRs for fixed Trac tickets#13153
irozum wants to merge 1 commit into
WordPress:trunkfrom
irozum:task/65892-cleanup-pr-search-not-matching

Conversation

@irozum

@irozum irozum commented Aug 18, 2026

Copy link
Copy Markdown

The reusable-cleanup-pull-requests.yml workflow closes open PRs that reference a Trac ticket noted as fixed in a commit message. It does this by searching GitHub for PRs whose body contains either the full Trac ticket URL or a core-<id> string, then double-checks the match against the PR's body text before closing it.

Both the search and the double-check miss PRs that reference the ticket as a Markdown link with just the ticket number as the link text (e.g. Trac ticket: [65864](https://core.trac.wordpress.org/ticket/65864)), which the PR template's own wording ("a link to the WordPress Trac ticket") doesn't rule out. GitHub's search index only covers a PR's rendered/visible text, not Markdown link targets, so the URL search term never matches this style. The double-check filter had the same problem in a second way: it read the bodyText field, which strips Markdown links down to their visible text and drops the URL entirely, so even a PR that did surface via search would fail the manual re-check.

This fixes both:

  • Adds the bare ticket number as a third alternative search term, since GitHub's index does cover the plain ticket number when it's the visible text of a link.
  • Switches the manual re-check from bodyText to the raw body field, which retains the literal URL even inside a Markdown link, so the widened search doesn't introduce false positives from unrelated PRs that merely mention the same number.

Verified against the real GitHub GraphQL API using ticket #65864 (the ticket cited in the bug report) — the current search misses PR #13021 (Markdown-link style), and the widened query surfaces it. Also unit-verified the body-matching logic in isolation against a plain-URL body, a Markdown-link body, a core-<id> body, and a deliberately unrelated body that just happens to mention the same number — the fix matches the first three and correctly rejects the last. actionlint and zizmor both pass clean on the modified file.

Trac ticket: https://core.trac.wordpress.org/ticket/65892

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Sonnet 5
Used for: Root-cause investigation (via GitHub's GraphQL API), implementation, and PR description. Reviewed by Igor Rozum.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props irozum.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

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.

1 participant