Skip to content

Commit 6e94210

Browse files
committed
Support github in package_managers
Signed-off-by: Keshav Priyadarshi <[email protected]>
1 parent 838cb28 commit 6e94210

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/fetchcode/package_managers.py

+15
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,21 @@ def get_conan_versions_from_purl(purl):
259259
yield PackageVersion(value=version)
260260

261261

262+
@router.route("pkg:github/.*")
263+
def get_conan_versions_from_purl(purl):
264+
"""Fetch versions of ``github`` packages using GitHub REST API."""
265+
purl = PackageURL.from_string(purl)
266+
response = get_response(
267+
url=(f"https://api.github.com/repos/{purl.namespace}/{purl.name}/releases"),
268+
content_type="json",
269+
)
270+
for release in response:
271+
yield PackageVersion(
272+
value=release["tag_name"],
273+
release_date=dateparser.parse(release["published_at"]),
274+
)
275+
276+
262277
@router.route("pkg:golang/.*")
263278
def get_golang_versions_from_purl(purl):
264279
"""Fetch versions of Go "golang" packages from the Go proxy API."""

0 commit comments

Comments
 (0)