:calls: `POST /graphql `_ with a mutation to enable pull request auto merge
(
self,
merge_method: Opt[str] = "MERGE",
author_email: Opt[str] = NotSet,
client_mutation_id: Opt[str] = NotSet,
commit_body: Opt[str] = NotSet,
commit_headline: Opt[str] = NotSet,
expected_head_oid: Opt[str] = NotSet,
)
| 874 | return self.head.repo.get_git_ref(f"heads/{self.head.ref}").delete() |
| 875 | |
| 876 | def enable_automerge( |
| 877 | self, |
| 878 | merge_method: Opt[str] = "MERGE", |
| 879 | author_email: Opt[str] = NotSet, |
| 880 | client_mutation_id: Opt[str] = NotSet, |
| 881 | commit_body: Opt[str] = NotSet, |
| 882 | commit_headline: Opt[str] = NotSet, |
| 883 | expected_head_oid: Opt[str] = NotSet, |
| 884 | ) -> dict[str, Any]: |
| 885 | """ |
| 886 | :calls: `POST /graphql <https://docs.github.com/en/graphql>`_ with a mutation to enable pull request auto merge |
| 887 | <https://docs.github.com/en/graphql/reference/mutations#enablepullrequestautomerge> |
| 888 | """ |
| 889 | assert is_optional(author_email, str), author_email |
| 890 | assert is_optional(client_mutation_id, str), client_mutation_id |
| 891 | assert is_optional(commit_body, str), commit_body |
| 892 | assert is_optional(commit_headline, str), commit_headline |
| 893 | assert is_optional(expected_head_oid, str), expected_head_oid |
| 894 | assert isinstance(merge_method, str) and merge_method in ["MERGE", "REBASE", "SQUASH"], merge_method |
| 895 | |
| 896 | # Define the variables |
| 897 | variables = { |
| 898 | "pullRequestId": self.node_id, |
| 899 | "authorEmail": author_email, |
| 900 | "clientMutationId": client_mutation_id, |
| 901 | "commitBody": commit_body, |
| 902 | "commitHeadline": commit_headline, |
| 903 | "expectedHeadOid": expected_head_oid, |
| 904 | "mergeMethod": merge_method, |
| 905 | } |
| 906 | |
| 907 | # Make the request |
| 908 | _, data = self._requester.graphql_named_mutation( |
| 909 | mutation_name="enablePullRequestAutoMerge", |
| 910 | mutation_input=NotSet.remove_unset_items(variables), |
| 911 | output_schema="actor { avatarUrl login resourcePath url } clientMutationId", |
| 912 | ) |
| 913 | return data |
| 914 | |
| 915 | def disable_automerge( |
| 916 | self, |
no test coverage detected