Skip to content

Commit

Permalink
Support github in package_managers
Browse files Browse the repository at this point in the history
Signed-off-by: Keshav Priyadarshi <[email protected]>
  • Loading branch information
keshav-space committed Sep 18, 2023
1 parent 838cb28 commit 6e94210
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/fetchcode/package_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,21 @@ def get_conan_versions_from_purl(purl):
yield PackageVersion(value=version)


@router.route("pkg:github/.*")
def get_conan_versions_from_purl(purl):
"""Fetch versions of ``github`` packages using GitHub REST API."""
purl = PackageURL.from_string(purl)
response = get_response(
url=(f"https://api.github.com/repos/{purl.namespace}/{purl.name}/releases"),
content_type="json",
)
for release in response:
yield PackageVersion(
value=release["tag_name"],
release_date=dateparser.parse(release["published_at"]),
)


@router.route("pkg:golang/.*")
def get_golang_versions_from_purl(purl):
"""Fetch versions of Go "golang" packages from the Go proxy API."""
Expand Down

0 comments on commit 6e94210

Please sign in to comment.