Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

ci: ignore not-planned requests superseded by a newer completed issue

adnan-bhaldar33255621106c
diff --git a/.github/workflows/flag-duplicate-issue.yml b/.github/workflows/flag-duplicate-issue.yml
index 2f5dc046..83099582 100644
--- a/.github/workflows/flag-duplicate-issue.yml
+++ b/.github/workflows/flag-duplicate-issue.yml
@@ -5,7 +5,8 @@
# Earlier issue still open: "may be the same request" + the `possible duplicate` label. Earlier issue closed by a pull
# request merged after the latest release: the comment also links that pull request and says it comes in the next
# release (also `possible duplicate`). Earlier issue closed as "not planned" (and nothing above applies): the comment
-# links it, says it was closed as not planned, and the issue gets the `not planned` label. Issues closed any other
+# links it, says it was closed as not planned, and the issue gets the `not planned` label. This last case is skipped
+# when a newer issue for the same request was closed as completed (the newer decision wins). Issues closed any other
# way are ignored.
name: Flag possible duplicate issue
@@ -67,6 +68,11 @@ jobs:
reason = (issue.get('stateReason') or '').upper().replace(' ', '_')
return reason == 'NOT_PLANNED'
+ def is_completed(issue):
+ # Closed as completed (this is also the reason GitHub sets when a merged pull request closes an issue).
+ reason = (issue.get('stateReason') or '').upper().replace(' ', '_')
+ return reason == 'COMPLETED'
+
QUERY = ('query($owner:String!,$name:String!,$number:Int!){repository(owner:$owner,name:$name){'
'issue(number:$number){closedByPullRequestsReferences(first:10,includeClosedPrs:true){'
'nodes{number merged mergedAt}}}}}')
@@ -105,7 +111,7 @@ jobs:
['gh', 'issue', 'list', '--state', 'all', '--limit', '5000', '--json',
'number,title,body,state,stateReason'],
check=True, capture_output=True, text=True).stdout
- unreleased, duplicates, closed, not_planned = [], [], [], []
+ unreleased, duplicates, closed, not_planned, completed = [], [], [], [], []
for issue in json.loads(listing):
if issue['number'] >= me:
continue
@@ -121,6 +127,8 @@ jobs:
not_planned.append(issue['number'])
else:
closed.append(issue['number'])
+ if is_completed(issue):
+ completed.append(issue['number'])
# Closed issues count only when a merged pull request closed them, after the latest release. The newest
# ten are checked: those are the ones a pull request since the release can have closed.
@@ -130,13 +138,14 @@ jobs:
unreleased.append((number, pr['number']))
# Priority: an unreleased fix, then a still-open request, then an earlier "not planned" decision
- # (the most recent one, since it is the latest word from the maintainers).
+ # (the most recent one, since it is the latest word from the maintainers). The "not planned" case is
+ # skipped when a newer issue for the same request was closed as completed: the newer decision wins.
if unreleased:
kind = 'release'
original, pull = min(unreleased)
elif duplicates:
kind, original, pull = 'duplicate', min(duplicates), ''
- elif not_planned:
+ elif not_planned and not (completed and max(completed) > max(not_planned)):
kind, original, pull = 'notplanned', max(not_planned), ''
else:
print('No duplicate found')