MCPcopy Create free account
hub / github.com/bitsandbytes-foundation/bitsandbytes / main

Function main

scripts/stale.py:30–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28
29
30def main():
31 g = Github(os.environ["GITHUB_TOKEN"])
32 repo = g.get_repo("TimDettmers/bitsandbytes")
33 open_issues = repo.get_issues(state="open")
34
35 for issue in open_issues:
36 comments = sorted([comment for comment in issue.get_comments()], key=lambda i: i.created_at, reverse=True)
37 last_comment = comments[0] if len(comments) > 0 else None
38 if (
39 last_comment is not None
40 and last_comment.user.login == "github-actions[bot]"
41 and (dt.now(timezone.utc) - issue.updated_at).days > 7
42 and (dt.now(timezone.utc) - issue.created_at).days >= 30
43 and not any(label.name.lower() in LABELS_TO_EXEMPT for label in issue.get_labels())
44 ):
45 issue.edit(state="closed")
46 elif (
47 (dt.now(timezone.utc) - issue.updated_at).days > 23
48 and (dt.now(timezone.utc) - issue.created_at).days >= 30
49 and not any(label.name.lower() in LABELS_TO_EXEMPT for label in issue.get_labels())
50 ):
51 issue.create_comment(
52 "This issue has been automatically marked as stale because it has not had "
53 "recent activity. If you think this still needs to be addressed "
54 "please comment on this thread.\n\n",
55 )
56
57
58if __name__ == "__main__":

Callers 1

stale.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected