ci/github-script/merge: improve testability
By only ignoring already-handled comments when running non-dry, it's much easier to look at existing PRs, for which the merge bot already commented, and iterate on them locally. It's dry mode anyway, so it won't hurt to get a few more merge comments in the console output.
This commit is contained in:
@@ -168,14 +168,15 @@ async function handleMerge({
|
||||
// Ignore comments where the user has been deleted already.
|
||||
user &&
|
||||
// Ignore comments which had already been responded to by the bot.
|
||||
!events.some(
|
||||
({ event, body }) =>
|
||||
['commented'].includes(event) &&
|
||||
// We're only testing this hidden reference, but not the author of the comment.
|
||||
// We'll just assume that nobody creates comments with this marker on purpose.
|
||||
// Additionally checking the author is quite annoying for local debugging.
|
||||
body.match(new RegExp(`^<!-- comment: ${node_id} -->$`, 'm')),
|
||||
),
|
||||
(dry ||
|
||||
!events.some(
|
||||
({ event, body }) =>
|
||||
['commented'].includes(event) &&
|
||||
// We're only testing this hidden reference, but not the author of the comment.
|
||||
// We'll just assume that nobody creates comments with this marker on purpose.
|
||||
// Additionally checking the author is quite annoying for local debugging.
|
||||
body.match(new RegExp(`^<!-- comment: ${node_id} -->$`, 'm')),
|
||||
)),
|
||||
)
|
||||
|
||||
async function merge() {
|
||||
|
||||
Reference in New Issue
Block a user