Skip to content

Commit

Permalink
Requested review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
benfulton committed Aug 17, 2023
1 parent f8d822a commit b1d6848
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions .github/scripts/generate-first-issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@
if not os.path.exists(output_dir):
os.mkdir(output_dir)

def get_repository_topics(repo):
url = api_topic_base.format(repo=repo)
response = requests.get(url, headers=headers, params=data)
if response.status_code != 200:
print(
"Issue with repository topics, response %s: %s, sleeping"
% (response.status_code, response.reason)
)
time.sleep(60)
return []
return response.json().get('names') or []

def generate_markdown(line):
"""
Generate markdown for a repo / tags
Expand All @@ -58,16 +70,7 @@ def generate_markdown(line):

extra_tags = extra_tags.split(",")
repo = "/".join(repo.split("/")[-2:])
url = api_topic_base.format(repo=repo)
response = requests.get(url, headers=headers, params=data)
if response.status_code != 200:
print(
"Issue with response %s: %s, sleeping"
% (response.status_code, response.reason)
)
time.sleep(60)
return None, None
topics = response.json()['names']
topics = get_repository_topics(repo)

url = api_base.format(repo=repo)

Expand Down Expand Up @@ -95,7 +98,7 @@ def generate_markdown(line):
content = "---\n"

# Add labels as tags
tags = list([x["name"] for x in issue["labels"]]) + topics
tags = list(set([x["name"] for x in issue["labels"]] + topics))
if ISSUE_LABEL in tags:
tags.remove(ISSUE_LABEL)

Expand Down

0 comments on commit b1d6848

Please sign in to comment.