Skip to content

Commit

Permalink
added endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
user committed Dec 20, 2023
1 parent 17f5944 commit 6d77dbd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scripts/review_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from github import Github

BOT_REVIEW_LABEL = "bot-review"
GRAPHQL_ENDPOINT = "https://api.github.com/graphql"

# Read the pr event file, which is passed in as first arg
def read_pr_event():
Expand Down Expand Up @@ -44,7 +45,7 @@ def get_pull_request_graphql_id(accessToken,name,number):
}}
}}
}}"""
r = requests.post(endpoint, json={"query": query}, headers=headers)
r = requests.post(GRAPHQL_ENDPOINT, json={"query": query}, headers=headers)
return r.json()["data"]["repository"]["pullRequest"]["id"]

# use GraphQL to set pull request as draft
Expand All @@ -57,7 +58,7 @@ def set_pr_draft(accessToken,id):
}}
}}
}}"""
requests.post(endpoint, json={"query": query}, headers=headers)
requests.post(GRAPHQL_ENDPOINT, json={"query": query}, headers=headers)

# use GraphQL to set pull request as ready
def set_pr_ready(accessToken,id):
Expand All @@ -69,7 +70,7 @@ def set_pr_ready(accessToken,id):
}}
}}
}}"""
requests.post(endpoint, json={"query": query}, headers=headers)
requests.post(GRAPHQL_ENDPOINT, json={"query": query}, headers=headers)

if __name__ == "__main__":
accessToken = os.environ['GITHUB_TOKEN']
Expand Down

0 comments on commit 6d77dbd

Please sign in to comment.