MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / main

Function main

diffusers/utils/stale.py:37–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35
36
37def main():
38 g = Github(os.environ["GITHUB_TOKEN"])
39 repo = g.get_repo("huggingface/diffusers")
40 open_issues = repo.get_issues(state="open")
41
42 for issue in open_issues:
43 labels = [label.name.lower() for label in issue.get_labels()]
44 if "stale" in labels:
45 comments = sorted(issue.get_comments(), key=lambda i: i.created_at, reverse=True)
46 last_comment = comments[0] if len(comments) > 0 else None
47 if last_comment is not None and last_comment.user.login != "github-actions[bot]":
48 # Opens the issue if someone other than Stalebot commented.
49 issue.edit(state="open")
50 issue.remove_from_labels("stale")
51 elif (
52 (dt.now(timezone.utc) - issue.updated_at).days > 23
53 and (dt.now(timezone.utc) - issue.created_at).days >= 30
54 and not any(label in LABELS_TO_EXEMPT for label in labels)
55 ):
56 # Post a Stalebot notification after 23 days of inactivity.
57 issue.create_comment(
58 "This issue has been automatically marked as stale because it has not had "
59 "recent activity. If you think this still needs to be addressed "
60 "please comment on this thread.\n\nPlease note that issues that do not follow the "
61 "[contributing guidelines](https://github.com/huggingface/diffusers/blob/main/CONTRIBUTING.md) "
62 "are likely to be ignored."
63 )
64 issue.add_to_labels("stale")
65
66
67if __name__ == "__main__":

Callers 1

stale.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected