• Home
  • Raw
  • Download

Lines Matching +full:get +full:- +full:conclusion

5 # This source code is licensed under the BSD-style license found in the
8 # NB: the following functions are used in Meta-internal workflows
136 conclusion
147 conclusion
330 conclusion
379 # This query needs read-org permission
444 RE_GHSTACK_HEAD_REF = re.compile(r"^(gh/[^/]+/[0-9]+/)head$")
448 r"https://github.com/(?P<owner>[^/]+)/(?P<repo>[^/]+)/pull/(?P<number>[0-9]+)",
452 RE_DIFF_REV = re.compile(r"^Differential Revision:.+?(D[0-9]+)", re.MULTILINE)
460 INTERNAL_CHANGES_CHECKRUN_NAME = "Meta Internal-Only Changes Check"
464 # This could be set to -1 to ignore all flaky and broken trunk failures. On the
469 def gh_get_pr_info(org: str, proj: str, pr_no: int) -> Any:
475 def gh_get_team_members(org: str, name: str) -> List[str]:
489 warn(f"Requested non-existing team {org}/{name}")
496 def get_check_run_name_prefix(workflow_run: Any) -> str:
503 def is_passing_status(status: Optional[str]) -> bool:
511 ) -> JobNameToStateDict:
515 # workflow -> job -> job info
521 def add_conclusions(edges: Any) -> None:
531 workflow_conclusion = node["conclusion"]
549 existing_checkrun = workflow_obj.jobs.get(checkrun_name)
556 checkrun_node["conclusion"],
598 def parse_args() -> Any:
602 parser.add_argument("--dry-run", action="store_true")
603 parser.add_argument("--revert", action="store_true")
604 parser.add_argument("--force", action="store_true")
605 parser.add_argument("--ignore-current", action="store_true")
606 parser.add_argument("--check-mergeability", action="store_true")
607 parser.add_argument("--comment-id", type=int)
608 parser.add_argument("--reason", type=str)
613 def can_skip_internal_checks(pr: "GitHubPR", comment_id: Optional[int] = None) -> bool:
619 return comment.author_login == "facebook-github-bot"
627 ) -> List[Tuple["GitHubPR", str]]:
634 f"Could not find PR-resolved string in {msg} of ghstacked PR {pr.pr_num}"
650 ) -> List[Tuple["GitHubPR", str]]:
652Get the PRs in the stack that are below this PR (inclusive). Throws error if any of the open PRs …
655 # For ghstack, cherry-pick commits based from origin
659 def skip_func(idx: int, candidate: "GitHubPR") -> bool:
689 def __init__(self, org: str, project: str, pr_num: int) -> None:
704 def is_closed(self) -> bool:
707 def is_cross_repo(self) -> bool:
710 def base_ref(self) -> str:
713 def default_branch(self) -> str:
716 def head_ref(self) -> str:
719 def is_ghstack_pr(self) -> bool:
722 def get_ghstack_orig_ref(self) -> str:
726 def is_base_repo_private(self) -> bool:
729 def get_changed_files_count(self) -> int:
732 def last_commit(self) -> Any:
733 return self.info["commits"]["nodes"][-1]["commit"]
735 def get_merge_base(self) -> str:
757 def get_changed_files(self) -> List[str]:
780 def get_submodules(self) -> List[str]:
787 def get_changed_submodules(self) -> List[str]:
791 def has_invalid_submodule_updates(self) -> bool:
803 def _get_reviews(self) -> List[Tuple[str, str]]:
828 def get_approved_by(self) -> List[str]:
831 def get_commit_count(self) -> int:
834 def get_pr_creator_login(self) -> str:
837 def _fetch_authors(self) -> List[Tuple[str, str]]:
842 def add_authors(info: Dict[str, Any]) -> None:
869 def get_committer_login(self, num: int = 0) -> str:
872 def get_committer_author(self, num: int = 0) -> str:
875 def get_labels(self) -> List[str]:
886 def get_checkrun_conclusions(self) -> JobNameToStateDict:
887 """Returns dict of checkrun -> [conclusion, url]"""
894 ) -> Any:
900 cs_cursor=edges[edge_idx - 1]["cursor"] if edge_idx > 0 else None,
904 -1
906 checkruns = last_commit["checkSuites"]["nodes"][-1]["checkRuns"]
909 def get_pr_next_checksuites(checksuites: Any) -> Any:
915 cursor=checksuites["edges"][-1]["cursor"],
918 last_commit = info["commits"]["nodes"][-1]["commit"]
945 def get_authors(self) -> Dict[str, str]:
952 def get_author(self) -> str:
963 def get_title(self) -> str:
966 def get_body(self) -> str:
969 def get_merge_commit(self) -> Optional[str]:
973 def get_pr_url(self) -> str:
977 def _comment_from_node(node: Any) -> GitHubComment:
989 def get_comments(self) -> List[GitHubComment]:
1011 def get_last_comment(self) -> GitHubComment:
1012 return self._comment_from_node(self.info["comments"]["nodes"][-1])
1014 def get_comment_by_id(self, database_id: int) -> GitHubComment:
1016 # Fastpath - try searching in partial prefetched comments
1037 def get_diff_revision(self) -> Optional[str]:
1041 def has_internal_changes(self) -> bool:
1050 def has_no_connected_diff(self) -> bool:
1063 ) -> List["GitHubPR"]:
1094 ) -> str:
1109 # Mention PR co-authors
1112 msg += f"\nCo-authored-by: {author_name}"
1120 def add_numbered_label(self, label_base: str, dry_run: bool) -> None:
1138 ) -> None:
1178 ignore_current_checks=ignorable_checks.get("IGNORE_CURRENT_CHECK", []),
1179 broken_trunk_checks=ignorable_checks.get("BROKEN_TRUNK", []),
1180 flaky_checks=ignorable_checks.get("FLAKY", []),
1181 unstable_checks=ignorable_checks.get("UNSTABLE", []),
1182 last_commit_sha=self.last_commit().get("oid", ""),
1201 ) -> List["GitHubPR"]:
1203 … :param skip_all_rule_checks: If true, skips all rule checks, useful for dry-running merge locally
1210 pr_branch_name = f"__pull-request-{self.pr_num}__init__"
1212 repo._run_git("merge", "--squash", pr_branch_name)
1213 repo._run_git("commit", f'--author="{self.get_author()}"', "-m", msg)
1225 def __init__(self, message: str, rule: Optional["MergeRule"] = None) -> None:
1248 org: str, project: str, labels: List[str], template: str = "bug-report.yml"
1249 ) -> str:
1260 ) -> List[MergeRule]:
1263 NB: this function is used in Meta-internal workflows, see the comment
1291 ) -> Tuple[
1301 NB: this function is used in Meta-internal workflows, see the comment at the top of
1338 # Score 0 to 10K - how many files rule matched
1339 # Score 10K - matched all files, but no overlapping approvers
1340 # Score 20K - matched all files and approvers, but mandatory checks are pending
1341 # Score 30k - Matched all files and approvers, but mandatory checks failed
1353 num_matching_files = len(changed_files) - len(non_matching_files)
1359 … f"{num_matching_files} files matched, but there are still non-matching files:",
1391 … f"- {name} ({', '.join(approved_by[:5])}{', ...' if len(approved_by) > 5 else ''})"
1482 def checks_to_str(checks: List[Tuple[str, Optional[str]]]) -> str:
1488 ) -> List[str]:
1490 f"- [{c[0]}]({c[1]})" if c[1] is not None else f"- {c[0]}" for c in checks[:5]
1517 ) -> None:
1522 # Decide not to save the record to Rockset if dry-run is set to not pollute
1568 def get_rockset_results(head_sha: str, merge_base: str) -> List[Dict[str, Any]]:
1574 j.conclusion,
1598 def get_drci_classifications(pr_num: int, project: str = "pytorch") -> Any:
1615 return failures.get(str(pr_num), {}) if failures else {}
1618 REMOVE_JOB_NAME_SUFFIX_REGEX = re.compile(r", [0-9]+, [0-9]+, .+\)$")
1621 def remove_job_name_suffix(name: str, replacement: str = ")") -> str:
1628 ) -> bool:
1635 for broken_trunk in drci_classifications.get("BROKEN_TRUNK", [])
1642 ) -> bool:
1647 return any(name == flaky["name"] for flaky in drci_classifications.get("FLAKY", []))
1652 conclusion: Optional[str],
1654 ) -> bool:
1656 After https://github.com/pytorch/test-infra/pull/4579, invalid cancelled
1663 or not conclusion
1664 or conclusion.upper() != "CANCELLED"
1671 name != failure["name"] for failure in drci_classifications.get("FAILED", [])
1680 ) -> Dict[str, JobCheckState]:
1681 # Get the failure classification from Dr.CI, which is the source of truth
1683 # to get the latest results as well as update Dr.CI PR comment
1686 def get_readable_drci_results(drci_classifications: Any) -> str:
1789 ) -> List[JobCheckState]:
1793 def get_pr_commit_sha(repo: GitRepo, pr: GitHubPR) -> str:
1805 ) -> Tuple[str, str]:
1835 ) -> List[Tuple[str, GitHubPR]]:
1837 Get the PRs in the stack that are above this PR (inclusive).
1847 skip_len = len(rev_list) - 1
1853 # Validate that candidate always ends rev-list
1854 if rev_list[-len(candidate) :] != candidate:
1860 rev_list = rev_list[:-skip_len]
1880 ) -> None:
1905 revert_message += "\ncc: @pytorch/pytorch-dev-infra"
1923 ) -> None:
1957 def prefix_with_github_url(suffix_str: str) -> str:
1961 def check_for_sev(org: str, project: str, skip_mandatory_checks: bool) -> None:
1982 def has_label(labels: List[str], pattern: Pattern[str] = CIFLOW_LABEL) -> bool:
1990 ) -> Tuple[
2075 ) -> None:
2093 # ignored and is toggled by the --ignore-current flag
2148 elapsed_time = current_time - start_time
2228 gh_add_labels(pr.org, pr.project, pr.pr_num, ["land-failed"], dry_run)
2232 def main() -> None:
2238 def handle_exception(e: Exception, title: str = "Merge failed") -> None:
2302 "Cross-repo ghstack merges are not supported",
2353 last_commit_sha=pr.last_commit().get("oid", ""),