mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 23:07:18 +03:00
732d512647
Summary:
Historically, we avoided running the Black autoformatter on our
fork of ghstack so that the code would be easier to diff with
upstream. Now that Black is run on upstream ghstack:
e5eca89cb3
we have no reason to exclude it from our linter.
Going forward, we should update the GitHub CI to run `black --check`
and report back so that contributors get this signal as well.
Reviewed By: zsol
Differential Revision: D42494629
fbshipit-source-id: 7f09ec46f687e56662f4f6ac477fd2fd077709d6
41 lines
1.0 KiB
Python
41 lines
1.0 KiB
Python
import logging
|
|
|
|
import ghstack.github
|
|
import ghstack.github_utils
|
|
import ghstack.shell
|
|
|
|
|
|
def main(
|
|
pull_request: str,
|
|
github: ghstack.github.GitHubEndpoint,
|
|
close: bool = False,
|
|
) -> None:
|
|
|
|
params = ghstack.github_utils.parse_pull_request(pull_request)
|
|
pr_result = github.graphql_sync(
|
|
"""
|
|
query ($owner: String!, $name: String!, $number: Int!) {
|
|
repository(name: $name, owner: $owner) {
|
|
pullRequest(number: $number) {
|
|
id
|
|
}
|
|
}
|
|
}
|
|
""",
|
|
**params
|
|
)
|
|
pr_id = pr_result["data"]["repository"]["pullRequest"]["id"]
|
|
|
|
if close:
|
|
logging.info("Closing {owner}/{name}#{number}".format(**params))
|
|
github.graphql_sync(
|
|
"""
|
|
mutation ($input: ClosePullRequestInput!) {
|
|
closePullRequest(input: $input) {
|
|
clientMutationId
|
|
}
|
|
}
|
|
""",
|
|
input={"pullRequestId": pr_id, "clientMutationId": "A"},
|
|
)
|