[llvm] workflows: Add some automation for commit access requests (PR #123113)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 15 11:37:16 PST 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r 35f9d2ac49eb3344f528c5b0c3b75330ade93982...83ee7a3bc34de2898fe4f2286f9b1c6679beee67 llvm/utils/git/github-automation.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- github-automation.py 2025-01-15 18:27:11.000000 +0000
+++ github-automation.py 2025-01-15 19:36:43.848399 +0000
@@ -207,16 +207,16 @@
if self.team_name == team.name.lower():
return team
return None
-def get_top_values(values : dict, top : int = 3) -> list:
- return [v for v in sorted(values.items(), key = lambda x: x[1], reverse = True)][:top]
+def get_top_values(values: dict, top: int = 3) -> list:
+ return [v for v in sorted(values.items(), key=lambda x: x[1], reverse=True)][:top]
def get_user_values_str(values: list) -> str:
- return ', '.join([f'@{v[0]} ({v[1]})' for v in values])
+ return ", ".join([f"@{v[0]} ({v[1]})" for v in values])
class PRGreeter:
COMMENT_TAG = "<!--LLVM NEW CONTRIBUTOR COMMENT-->\n"
@@ -245,10 +245,11 @@
If you have further questions, they may be answered by the [LLVM GitHub User Guide](https://llvm.org/docs/GitHub.html).
You can also ask questions in a comment on this PR, on the [LLVM Discord](https://discord.com/invite/xS7Z362) or on the [forums](https://discourse.llvm.org/)."""
self.pr.as_issue().create_comment(comment)
return True
+
class CommitRequestGreeter:
def __init__(self, token: str, repo: str, issue_number: int):
self.repo = github.Github(token).get_repo(repo)
self.issue = self.repo.get_issue(issue_number)
@@ -258,16 +259,16 @@
comment = f"""
@{self.issue.user.login} thank you for apply for commit access. Please review the project's [code review policy](https://llvm.org/docs/CodeReview.html).
"""
self.issue.create_comment(comment)
- #Post activity summary:
+ # Post activity summary:
total_prs = 0
merged_prs = 0
merged_by = {}
reviewed_by = {}
- for i in self.repo.get_issues(creator = self.issue.user.login, state = 'all'):
+ for i in self.repo.get_issues(creator=self.issue.user.login, state="all"):
issue_reviewed_by = set()
try:
pr = i.as_pull_request()
total_prs += 1
for c in pr.get_review_comments():
``````````
</details>
https://github.com/llvm/llvm-project/pull/123113
More information about the llvm-commits
mailing list