Skip to content

Commit

Permalink
fix #11
Browse files Browse the repository at this point in the history
  • Loading branch information
honzajavorek committed May 16, 2024
1 parent 9952813 commit b979b46
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions jg/hen/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,8 @@ async def check_profile_url(
raise_on_error: bool = False,
) -> Summary:
results = []
username = parse_username(profile_url)
try:
username = parse_username(profile_url)

import jg.hen.rules # noqa
import jg.hen.insights # noqa

Expand All @@ -125,21 +124,25 @@ async def check_profile_url(
response = await github.rest.repos.async_get(username, minimal_repo.name)
repo = response.parsed_data
readme = None
try:
response = await github.rest.repos.async_get_readme(
username,
repo.name,
headers={"Accept": "application/vnd.github.html+json"},
)
readme = response.text
except RequestFailed as error:
if error.response.status_code != 404:
raise
pin = get_pin(pinned_urls, repo.html_url)
# For efficiency, ignore downloading README for archived repos
# which are not pinned
if pin is not None or not repo.archived:
try:
response = await github.rest.repos.async_get_readme(
username,
repo.name,
headers={"Accept": "application/vnd.github.html+json"},
)
readme = response.text
except RequestFailed as error:
if error.response.status_code != 404:
raise
context = RepositoryContext(
repo=repo,
readme=readme,
is_profile=repo.name == username,
pin=get_pin(pinned_urls, repo.html_url),
pin=pin,
)
results.extend(await send(on_repo, context=context))
contexts.append(context)
Expand Down

0 comments on commit b979b46

Please sign in to comment.