Update status label when reopening a report based on closed status #6
21
labels.py
21
labels.py
@ -25,7 +25,8 @@ def issues_event(data):
|
|||||||
issue_labels = issue["labels"]
|
issue_labels = issue["labels"]
|
||||||
|
|
||||||
# Ensure valid status on issue close/open.
|
# Ensure valid status on issue close/open.
|
||||||
status_closed = {"Status/Archived", "Status/Resolved", "Status/Duplicate"}
|
status_resolved = "Status/Resolved"
|
||||||
|
status_closed = {"Status/Archived", "Status/Duplicate", status_resolved}
|
||||||
status_prefix = "Status/"
|
status_prefix = "Status/"
|
||||||
type_prefix = "Type/"
|
type_prefix = "Type/"
|
||||||
|
|
||||||
@ -39,12 +40,20 @@ def issues_event(data):
|
|||||||
else:
|
else:
|
||||||
new_status = "Status/Resolved"
|
new_status = "Status/Resolved"
|
||||||
elif action == "reopened":
|
elif action == "reopened":
|
||||||
for label in issue_labels:
|
# Reopen as "Needs Triage" unless the issue was "Resolved"
|
||||||
if label["name"].startswith(status_prefix) and label["name"] not in status_closed:
|
# Reopening a issue after it had been set to "Resolved" means a commit
|
||||||
return
|
# attempted to fix it, but didn't actually fix it and people are still
|
||||||
|
# experiencing the issue.
|
||||||
# Set to Needs Triage
|
|
||||||
new_status = "Status/Needs Triage"
|
new_status = "Status/Needs Triage"
|
||||||
|
for label in issue_labels:
|
||||||
|
if label["name"].startswith(status_prefix):
|
||||||
|
if label["name"] not in status_closed:
|
||||||
|
# Issue was reopened and had a new status label set.
|
||||||
|
# So skip setting a new one.
|
||||||
|
return
|
||||||
|
if label["name"] == status_resolved:
|
||||||
|
new_status = "Status/Confirmed"
|
||||||
|
break
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user