Returns a PullRequestState with the current PR state label based on label starting with LABEL_PREFIX. If more than one label is found raises EventError. If no label is found returns None.
(self)
| 153 | self.set_state(next_state) |
| 154 | |
| 155 | def get_current_state(self): |
| 156 | """ |
| 157 | Returns a PullRequestState with the current PR state label |
| 158 | based on label starting with LABEL_PREFIX. |
| 159 | If more than one label is found raises EventError. |
| 160 | If no label is found returns None. |
| 161 | """ |
| 162 | states = [label.name for label in self.pull.get_labels() |
| 163 | if label.name.startswith(LABEL_PREFIX)] |
| 164 | if len(states) > 1: |
| 165 | raise EventError(f"PR cannot be on more than one states - {states}") |
| 166 | elif states: |
| 167 | return PullRequestState(states[0]) |
| 168 | |
| 169 | def clear_current_state(self): |
| 170 | """ |
no test coverage detected