Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
driazati committed Sep 16, 2022
1 parent 4040f07 commit 2deccf3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions ci/scripts/git_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def dry_run_token(is_dry_run: bool) -> Any:


class GitHubRepo:
GRAPHQL_URL = "https://api.github.com/graphql"

def __init__(self, user, repo, token, test_data=None):
self.token = token
self.user = user
Expand All @@ -82,14 +84,13 @@ def graphql(self, query: str, variables: Optional[Dict[str, str]] = None) -> Dic
if variables is None:
variables = {}

url = "https://api.github.com/graphql"
response = self._request(
url,
self.GRAPHQL_URL,
{"query": query, "variables": variables},
method="POST",
)
if self.dry_run():
return self.testing_response("POST", url)
return self.testing_response("POST", self.GRAPHQL_URL)

if "data" not in response:
msg = f"Error fetching data with query:\n{query}\n\nvariables:\n{variables}\n\nerror:\n{json.dumps(response, indent=2)}"
Expand Down
4 changes: 3 additions & 1 deletion ci/scripts/github_commenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@


class BotCommentBuilder:
ALLOWLIST_USERS = {"driazati", "gigiblender", "areusch"}

def __init__(self, github: GitHubRepo, data: Dict[str, Any]):
self.github = github
self.pr_number = data["number"]
Expand Down Expand Up @@ -88,7 +90,7 @@ def _post_comment(self, body_items: Dict[str, str]):

logging.info(f"Commenting {comment} on {url}")

if self.author not in {"driazati", "gigiblender", "areusch"}:
if self.author not in self.ALLOWLIST_USERS:
logging.info(f"Skipping comment for author {self.author}")
return

Expand Down
2 changes: 1 addition & 1 deletion ci/scripts/github_tag_teams.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def get_tags(pr_data: Dict[str, Any], github: GitHubRepo, team_issue: int) -> st
print(f"Terminating since {pr['number']} is a draft")
exit(0)

# # PRs/issues have the same structure for the fields needed here
# PRs/issues have the same structure for the fields needed here
item = issue if issue is not None else pr
title = item["title"]
body = item["body"]
Expand Down

0 comments on commit 2deccf3

Please sign in to comment.