Skip to content

Commit ce5e3d0

Browse files
Keep GitHub package tags with no release date
Signed-off-by: Ali Zulfiqar <codewithfourtix@gmail.com>
1 parent 27c4fc9 commit ce5e3d0

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

src/fetchcode/package_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def _get_github_packages(purl, version_regex, ignored_tag_regex, default_package
131131

132132
download_url = archive_download_url.format(org=purl.namespace, name=purl.name, tag_name=tag)
133133

134-
date = date.strftime("%Y-%m-%dT%H:%M:%S")
134+
date = date.strftime("%Y-%m-%dT%H:%M:%S") if date else None
135135
package_dict.update(
136136
{
137137
"download_url": download_url,

tests/test_github_missing_date.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from packageurl import PackageURL
2+
3+
from fetchcode import package_util
4+
from fetchcode.packagedcode_models import Package
5+
6+
7+
def test_github_package_without_release_date(monkeypatch):
8+
monkeypatch.setattr(
9+
package_util.utils, "fetch_github_tags_gql", lambda purl: [("v1.2.3", None)]
10+
)
11+
purl = PackageURL("github", "example", "project")
12+
packages = list(package_util.get_github_packages(purl, None, None, Package(**purl.to_dict())))
13+
assert len(packages) == 1
14+
assert packages[0].version == "1.2.3"
15+
assert packages[0].release_date is None

0 commit comments

Comments
 (0)