Skip to content

Commit 4fe4270

Browse files
committed
Ignore builds where the most recent PR is closed
If a pull request is closed, it follows that the change was either accepted (in which case it is now in main) or rejected. In our own projects, we try to delete branches once the corresponding PR is closed but contributors may not do this. Treat branches whose most recent PR is closed as if they were deleted. Fixes #21
1 parent f545106 commit 4fe4270

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

godoctopus.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,18 @@ def main() -> None:
223223
item: dict[str, Any] = {"name": f"{org}/{branch_name}"}
224224

225225
try:
226-
item["pull_request"] = pull_requests[f"{org}:{branch_name}"][0]
226+
pull_request = pull_requests[f"{org}:{branch_name}"][0]
227227
except (KeyError, IndexError):
228228
pass
229+
else:
230+
if pull_request["state"] == "closed":
231+
logging.info(
232+
"Ignoring branch %s; newest pull request %s is closed",
233+
item["name"],
234+
pull_request["url"],
235+
)
236+
continue
237+
item["pull_request"] = pull_request
229238

230239
if branch.build:
231240
item["build"] = branch.build

0 commit comments

Comments
 (0)