Lines Matching +full:github +full:- +full:automation
3 # ======- github-automation - LLVM GitHub Automation Routines--*- python -*--==#
7 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
9 # ==-------------------------------------------------------------------------==#
15 import github
29 1. In the comments of this issue, request for it to be assigned to you, or just create a [pull request](https://github.com/llvm/llvm-project/pulls) after following the steps below. [Mention](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) this issue in the description of the pull request.
31 1. [Run the test suite](https://llvm.org/docs/TestingGuide.html#unit-and-regression-tests) locally. Remember that the subdirectories under `test/` create fine-grained testing targets, so you can e.g. use `make check-clang-ast` to only run Clang's AST tests.
33 1. Run [`git clang-format HEAD~1`](https://clang.llvm.org/docs/ClangFormat.html#git-integration) to format your changes.
34 1. Open a [pull request](https://github.com/llvm/llvm-project/pulls) to the [upstream repository](https://github.com/llvm/llvm-project) on GitHub. Detailed instructions can be found [in GitHub's documentation](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request). [Mention](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) this issue in the description of the pull request.
40 def _get_current_team(team_name, teams) -> Optional[github.Team.Team]:
48 # If the description of an issue/pull request is empty, the Github API
53 # https://github.com/github/markup/issues/1168#issuecomment-494946168
56 str = re.sub("@(?=\w)", "@<!-- -->", str)
58 str = re.sub("#(?=\d)", "#<!-- -->", str)
64 def team_name(self) -> str:
68 self.repo = github.Github(token).get_repo(repo)
69 self.org = github.Github(token).get_organization(self.repo.organization.login)
71 self._team_name = "issue-subscribers-{}".format(label_name).lower()
73 def run(self) -> bool:
80 if team.slug == "issue-subscribers-good-first-issue":
109 def team_name(self) -> str:
113 self.repo = github.Github(token).get_repo(repo)
114 self.org = github.Github(token).get_organization(self.repo.organization.login)
116 self._team_name = "pr-subscribers-{}".format(
119 self.COMMENT_TAG = "<!--LLVM PR SUMMARY COMMENT-->\n"
121 def get_summary_comment(self) -> github.IssueComment.IssueComment:
127 def run(self) -> bool:
134 # GitHub limits comments to 65,536 characters, let's limit the diff
142 diff_stats += f"- ({file.status}) {file.filename} ("
146 diff_stats += f"-{file.deletions}"
180 ---
205 def _get_current_team(self) -> Optional[github.Team.Team]:
213 COMMENT_TAG = "<!--LLVM NEW CONTRIBUTOR COMMENT-->\n"
216 repo = github.Github(token).get_repo(repo)
219 def run(self) -> bool:
221 # by a user new to LLVM and/or GitHub itself.
233 If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using `@` followed by their GitHub username.
237 If you have further questions, they may be answered by the [LLVM GitHub User Guide](https://llvm.org/docs/GitHub.html).
245 COMMENT_TAG = "<!--LLVM BUILDBOT INFORMATION COMMENT-->\n"
248 repo = github.Github(token).get_repo(repo)
252 def should_comment(self) -> bool:
268 def run(self) -> bool:
283 How to do this, and the rest of the post-merge process, is covered in detail [here](https://llvm.org/docs/MyFirstTypoFix.html#myfirsttypofix-issues-after-landing-your-pr).
285 If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of [LLVM development](https://llvm.org/docs/DeveloperPolicy.html#patch-reversion-policy). You can fix your changes and open a new PR to merge them again.
306 Extract the commit hash from the argument passed to /action github
308 directly or use the github URL, such as
309 https://github.com/llvm/llvm-project/commit/2832d7941f4207f1fcf813b27cf08cecc3086959
311 github_prefix = "https://github.com/llvm/llvm-project/commit/"
318 CHERRY_PICK_FAILED_LABEL = "release:cherry-pick-failed"
321 This class implements the sub-commands for the release-workflow command.
322 The current sub-commands are:
323 * create-branch
324 * create-pull-request
326 The execute_command method will automatically choose the correct sub-command
339 ) -> None:
352 def token(self) -> str:
356 def repo_name(self) -> str:
360 def issue_number(self) -> int:
364 def branch_repo_owner(self) -> str:
368 def branch_repo_name(self) -> str:
372 def branch_repo_token(self) -> str:
376 def llvm_project_dir(self) -> str:
380 def requested_by(self) -> str:
384 def repo(self) -> github.Repository.Repository:
385 return github.Github(self.token).get_repo(self.repo_name)
388 def issue(self) -> github.Issue.Issue:
392 def push_url(self) -> str:
393 return "https://{}@github.com/{}".format(
398 def branch_name(self) -> str:
402 def release_branch_for_issue(self) -> Optional[str]:
412 def print_release_branch(self) -> None:
415 def issue_notify_branch(self) -> None:
420 def issue_notify_pull_request(self, pull: github.PullRequest.PullRequest) -> None:
422 "/pull-request {}#{}".format(self.repo_name, pull.number)
425 def make_ignore_comment(self, comment: str) -> str:
428 a Github workflow to skip parsing this comment.
432 return "<!--IGNORE-->\n" + comment
434 def issue_notify_no_milestone(self, comment: List[str]) -> None:
441 def action_url(self) -> str:
443 return "https://github.com/{}/actions/runs/{}".format(
450 ) -> github.IssueComment.IssueComment:
452 "Failed to cherry-pick: {}\n\n".format(commit)
457 message += "Please manually backport the fix and push it to your github fork. Once this is done, please create a [pull request](https://github.com/llvm/llvm-project/compare)"
465 ) -> github.IssueComment.IssueComment:
474 def get_main_commit(self, cherry_pick_sha: str) -> github.Commit.Commit:
477 m = re.search("\(cherry picked from commit ([0-9a-f]+)\)", message)
482 def pr_request_review(self, pr: github.PullRequest.PullRequest):
508 def create_branch(self, commits: List[str]) -> bool:
514 a comment is added to the issue saying that the cherry-pick failed.
516 :param list commits: List of commits to cherry-pick.
519 print("cherry-picking", commits)
526 local_repo.git.cherry_pick("-x", c)
541 self, repo: github.Repository.Repository, head: str
542 ) -> bool:
548 ) -> bool:
555 https://docs.github.com/en/get-started/quickstart/github-glossary#base-branch
556 https://docs.github.com/en/get-started/quickstart/github-glossary#compare-branch
558 repo = github.Github(self.token).get_repo(self.repo_name)
570 commit_message = repo.get_commit(commits[-1]).commit.message
587 # issue that was used to request the cherry-pick
608 def execute_command(self) -> bool:
612 /cherry-pick< ><:> commit0 <commit1> <commit2> <...>
616 m = re.search(r"/cherry-pick\s*:? *(.*)", line)
632 repo = github.Github(token).get_repo(repo_name)
658 "--token", type=str, required=True, help="GitHub authentication token"
661 "--repo",
663 default=os.getenv("GITHUB_REPOSITORY", "llvm/llvm-project"),
664 help="The GitHub repository that we are working with in the form of <owner>/<repo> (e.g. llvm/llvm-project)",
668 issue_subscriber_parser = subparsers.add_parser("issue-subscriber")
669 issue_subscriber_parser.add_argument("--label-name", type=str, required=True)
670 issue_subscriber_parser.add_argument("--issue-number", type=int, required=True)
672 pr_subscriber_parser = subparsers.add_parser("pr-subscriber")
673 pr_subscriber_parser.add_argument("--label-name", type=str, required=True)
674 pr_subscriber_parser.add_argument("--issue-number", type=int, required=True)
676 pr_greeter_parser = subparsers.add_parser("pr-greeter")
677 pr_greeter_parser.add_argument("--issue-number", type=int, required=True)
679 pr_buildbot_information_parser = subparsers.add_parser("pr-buildbot-information")
680 pr_buildbot_information_parser.add_argument("--issue-number", type=int, required=True)
681 pr_buildbot_information_parser.add_argument("--author", type=str, required=True)
683 release_workflow_parser = subparsers.add_parser("release-workflow")
685 "--llvm-project-dir",
688 help="directory containing the llvm-project checkout",
691 "--issue-number", type=int, required=True, help="The issue number to update"
694 "--branch-repo-token",
696 help="GitHub authentication token to use for the repository where new branches will be pushed. Defaults to TOKEN.",
699 "--branch-repo",
701 default="llvmbot/llvm-project",
702 help="The name of the repo where new branches will be pushed (e.g. llvm/llvm-project)",
707 choices=["print-release-branch", "auto"],
712 "setup-llvmbot-git",
716 "--requested-by",
723 "request-release-note",
727 "--pr-number",
736 if args.command == "issue-subscriber":
741 elif args.command == "pr-subscriber":
746 elif args.command == "pr-greeter":
749 elif args.command == "pr-buildbot-information":
754 elif args.command == "release-workflow":
767 if args.sub_command == "print-release-branch":
772 elif args.command == "setup-llvmbot-git":
774 elif args.command == "request-release-note":