Skip to content

Commit 1d786df

Browse files
committed
Handle proposal-in-review/disposition-* labels when entering/exiting FCP (proposed)
1 parent 5e2ab9a commit 1d786df

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

command_handler.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -272,18 +272,14 @@ def _fcp_proposal_with_disposition(self, disposition: str):
272272
"cancel the current one first.")
273273
return
274274

275-
# Remove finished FCP label if present
276-
if self.config.github_fcp_finished_label in self.proposal_labels_str:
277-
self.proposal_labels_str.remove(self.config.github_fcp_finished_label)
278-
279275
# Post new status comment
280276
self._post_or_update_status_comment(
281277
voted_members=[self.comment["sender"]["login"]],
282278
concerns=[],
283279
disposition=disposition,
284280
)
285281

286-
# Add the relevant label
282+
# Add the relevant disposition label
287283
if disposition == "merge":
288284
self.proposal_labels_str.append(self.config.github_disposition_merge_label)
289285
elif disposition == "postpone":
@@ -294,6 +290,14 @@ def _fcp_proposal_with_disposition(self, disposition: str):
294290
# Add the proposal label
295291
self.proposal_labels_str.append(self.config.github_fcp_proposed_label)
296292

293+
# Remove proposal in review label if present
294+
if self.config.github_fcp_proposal_in_review_label in self.proposal_labels_str:
295+
self.proposal_labels_str.remove(self.config.github_fcp_proposal_in_review_label)
296+
297+
# Remove finished FCP label if present
298+
if self.config.github_fcp_finished_label in self.proposal_labels_str:
299+
self.proposal_labels_str.remove(self.config.github_fcp_finished_label)
300+
297301
def _process_status_comment_update_with_body(self, status_comment_body: str):
298302
"""Process an edit on a status comment. Checks to see if the required
299303
threshold of voters have been met for an FCP proposal.
@@ -531,6 +535,17 @@ def _cancel_fcp(self):
531535
else:
532536
self._post_comment("This proposal is not in FCP nor has had FCP proposed.")
533537

538+
# Remove any disposition labels if present
539+
if self.config.github_disposition_close_label in self.proposal_labels_str:
540+
self.proposal_labels_str.remove(self.config.github_disposition_close_label)
541+
if self.config.github_disposition_merge_label in self.proposal_labels_str:
542+
self.proposal_labels_str.remove(self.config.github_disposition_merge_label)
543+
if self.config.github_disposition_postpone_label in self.proposal_labels_str:
544+
self.proposal_labels_str.remove(self.config.github_disposition_postpone_label)
545+
546+
# Add the proposal in review label back again
547+
self.proposal_labels_str.append(self.config.github_fcp_proposal_in_review_label)
548+
534549
def _post_or_update_status_comment(
535550
self,
536551
voted_members: List[str] = None,
@@ -552,8 +567,8 @@ def _post_or_update_status_comment(
552567
"Team member @... has proposed ..."
553568
"""
554569
if (
555-
(voted_members is None or concerns is None or disposition is None) and
556-
existing_status_comment is None
570+
(voted_members is None or concerns is None or disposition is None) and
571+
existing_status_comment is None
557572
):
558573
log.error("Attempted to auto-retrieve status comment values without providing"
559574
"a status comment. Proposal num: #%d", self.proposal.number)

0 commit comments

Comments
 (0)