Update status label when reopening a report based on closed status #6
17
labels.py
17
labels.py
@ -43,8 +43,23 @@ def issues_event(data):
|
|||||||
if label["name"].startswith(status_prefix) and label["name"] not in status_closed:
|
if label["name"].startswith(status_prefix) and label["name"] not in status_closed:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Set to Needs Triage
|
# Use Needs Triage as a default
|
||||||
new_status = "Status/Needs Triage"
|
new_status = "Status/Needs Triage"
|
||||||
|
|
||||||
|
issue_timeline = utils.gitea_api_get(issue_url + "/timeline")
|
||||||
|
for event in issue_timeline:
|
||||||
|
if not event["type"] == "label":
|
||||||
|
# We are only interested in events that modify labels
|
||||||
|
continue
|
||||||
|
old_label_name = event["label"]["name"]
|
||||||
|
if not old_label_name.startswith(status_prefix):
|
||||||
|
# We are only interested in label events that modify `Status/` labels
|
||||||
|
continue
|
||||||
|
if old_label_name in status_closed:
|
||||||
|
# We are restoring the report to a open state, so we don't care about
|
||||||
|
# "closed" labels.
|
||||||
|
continue
|
||||||
|
new_status = old_label_name
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user