Skip to content

Commit c5b0652

Browse files
committed
[fix] Return False on true exceptions to avoid masking failures
1 parent 46f5bad commit c5b0652

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

.github/actions/bot-autoassign/issue_assignment_bot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def handle_issue_comment(self):
288288
return True
289289
except Exception as e:
290290
print(f"Error handling issue comment: {e}")
291-
return True
291+
return False
292292

293293
def handle_pull_request(self):
294294
if not self.event_payload:
@@ -314,7 +314,7 @@ def handle_pull_request(self):
314314
return True
315315
except Exception as e:
316316
print(f"Error handling pull request: {e}")
317-
return True
317+
return False
318318

319319
def run(self):
320320
if not self.github or not self.repo:
@@ -331,7 +331,7 @@ def run(self):
331331
return True
332332
except Exception as e:
333333
print(f"Error in main execution: {e}")
334-
return True
334+
return False
335335
finally:
336336
print("Issue Assignment Bot completed")
337337

.github/actions/bot-autoassign/pr_reopen_bot.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def handle_pr_reopen(self):
7777
return True
7878
except Exception as e:
7979
print(f"Error handling reopened PR: {e}")
80-
return True
80+
return False
8181

8282
def run(self):
8383
if not self.github or not self.repo:
@@ -101,7 +101,7 @@ class PRActivityBot(GitHubBot):
101101
def handle_contributor_activity(self):
102102
if not self.event_payload:
103103
print("No event payload available")
104-
return True
104+
return False
105105
try:
106106
issue_data = self.event_payload.get("issue", {})
107107
pr_number = issue_data.get("number")
@@ -157,7 +157,7 @@ def handle_contributor_activity(self):
157157
return True
158158
except Exception as e:
159159
print(f"Error handling contributor activity: {e}")
160-
return True
160+
return False
161161

162162
def run(self):
163163
if not self.github or not self.repo:
@@ -172,7 +172,7 @@ def run(self):
172172
return True
173173
except Exception as e:
174174
print(f"Error in main execution: {e}")
175-
return True
175+
return False
176176
finally:
177177
print("PR Activity Bot completed")
178178

.github/actions/bot-autoassign/stale_pr_bot.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def close_stale_pr(self, pr, days_inactive):
204204
return True
205205
except Exception as e:
206206
print(f"Error closing PR #{pr.number}: {e}")
207-
return True
207+
return False
208208

209209
def mark_pr_stale(self, pr, days_inactive):
210210
try:
@@ -267,7 +267,7 @@ def mark_pr_stale(self, pr, days_inactive):
267267
return True
268268
except Exception as e:
269269
print(f"Error marking PR #{pr.number}" f" as stale: {e}")
270-
return True
270+
return False
271271

272272
def send_stale_warning(self, pr, days_inactive):
273273
try:
@@ -316,12 +316,12 @@ def send_stale_warning(self, pr, days_inactive):
316316
return True
317317
except Exception as e:
318318
print("Error sending warning" f" for PR #{pr.number}: {e}")
319-
return True
319+
return False
320320

321321
def process_stale_prs(self):
322322
if not self.repo:
323323
print("GitHub repository not initialized")
324-
return True
324+
return False
325325
try:
326326
open_prs = self.repo.get_pulls(state="open")
327327
processed_count = 0
@@ -381,7 +381,7 @@ def process_stale_prs(self):
381381
return True
382382
except Exception as e:
383383
print(f"Error in process_stale_prs: {e}")
384-
return True
384+
return False
385385

386386
def run(self):
387387
if not self.github or not self.repo:
@@ -392,7 +392,7 @@ def run(self):
392392
return self.process_stale_prs()
393393
except Exception as e:
394394
print(f"Error in main execution: {e}")
395-
return True
395+
return False
396396
finally:
397397
print("Stale PR Management Bot completed")
398398

.github/actions/bot-autoassign/tests/test_pr_reopen_bot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def test_handle_contributor_activity_not_pr(self, bot_env):
194194

195195
def test_handle_contributor_activity_no_payload(self, bot_env):
196196
bot = PRActivityBot()
197-
assert bot.handle_contributor_activity()
197+
assert not bot.handle_contributor_activity()
198198

199199
def test_run_unsupported_event(self, bot_env):
200200
bot = PRActivityBot()

0 commit comments

Comments
 (0)