Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions .github/workflows/reusable-cleanup-pull-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,28 +54,36 @@ jobs:

for (const ticket of fixedList) {
const tracTicketUrl = `https://core.trac.wordpress.org/ticket/${ticket}`;
const corePrefix = `Core-${ticket}`;
const corePrefix = `core-${ticket}`;

const query = `
query($searchQuery: String!) {
search(query: $searchQuery, type: ISSUE_ADVANCED, first: 20) {
nodes {
... on PullRequest {
number
state
bodyText
}
}
}
}
`;

const searchQuery = `repo:${context.repo.owner}/${context.repo.repo} is:pr is:open in:body ( "${tracTicketUrl}" OR "${corePrefix}" )`;
const searchQuery = `repo:${context.repo.owner}/${context.repo.repo} is:pr is:open ( "${tracTicketUrl}" OR "${corePrefix}" )`;

const result = await github.graphql(query, {
searchQuery,
});

prNumbers.push(...result.search.nodes.map(pr => pr.number));
// Since search queries will match anywhere for any activity on a pull request, the body specifically needs to be manually checked.
const matchingPRs = result.search.nodes
.filter(
const bodyLower = pr.bodyText.toLowerCase();
Copy link
Member

@westonruter westonruter Oct 31, 2025

Choose a reason for hiding this comment

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

This looks like a syntax error to me. Shouldn't the arg to the filter() method look something like:

( pr ) => {
    const bodyLower = pr.bodyText.toLowerCase();
    return bodyLower.includes(tracTicketUrl) || bodyLower.includes(corePrefix);
}

Copy link
Member

Choose a reason for hiding this comment

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

pr => pr.bodyText.includes(tracTicketUrl) || pr.bodyText.includes(corePrefix)
)
Comment on lines +80 to +83
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.filter(
const bodyLower = pr.bodyText.toLowerCase();
pr => pr.bodyText.includes(tracTicketUrl) || pr.bodyText.includes(corePrefix)
)
.filter(( pr ) => {
const bodyLower = pr.bodyText.toLowerCase();
return bodyLower.includes(tracTicketUrl) || bodyLower.includes(corePrefix);
})

.map(pr => pr.number);

prNumbers.push(...matchingPRs);
}

return prNumbers;
Expand Down