Similar to the duplicate-url-check, it should be possible to look for the pattern:
- Issue opened
- A recent issue was closed
- Issue is by the same author
- The author closed the issue
- Issue is a duplicate, based on same URL
If these conditions are met:
- Close issue
- Reopen old issue
Most relevant change would probably be this line. It should have some additional conditions (pseudo code):
const recentDate = new Date(currentDate.getTime() - (4 * 60 * 60 * 1000)); // 4 hours
const recentDateISO = recentDate.toISOString();
const qualifiers = `type:issue repo:${repo.owner}/${repo.repo} state:closed author:${issue.user.login} closed:>${recentDateISO} label:"${labelsToCheck.join('","')}"`;
Did not find a way to search for 'closed by', but it seems like issue.closed_by.login
should be comparable once you actually fetch the details of the issue. Not sure if this condition is ultimately required.
Test case:
keiyoushi/extensions-source#485
keiyoushi/extensions-source#707
keiyoushi/extensions-source#3315
keiyoushi/extensions-source#3461