From ce5e3d0aef839f0b798e640c2d57772c4288d493 Mon Sep 17 00:00:00 2001 From: Ali Zulfiqar Date: Sat, 5 Sep 2026 22:13:43 +0500 Subject: [PATCH 1/2] Keep GitHub package tags with no release date Signed-off-by: Ali Zulfiqar --- src/fetchcode/package_util.py | 2 +- tests/test_github_missing_date.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/test_github_missing_date.py diff --git a/src/fetchcode/package_util.py b/src/fetchcode/package_util.py index 5284b85..0b00fef 100644 --- a/src/fetchcode/package_util.py +++ b/src/fetchcode/package_util.py @@ -131,7 +131,7 @@ def _get_github_packages(purl, version_regex, ignored_tag_regex, default_package download_url = archive_download_url.format(org=purl.namespace, name=purl.name, tag_name=tag) - date = date.strftime("%Y-%m-%dT%H:%M:%S") + date = date.strftime("%Y-%m-%dT%H:%M:%S") if date else None package_dict.update( { "download_url": download_url, diff --git a/tests/test_github_missing_date.py b/tests/test_github_missing_date.py new file mode 100644 index 0000000..af7cc95 --- /dev/null +++ b/tests/test_github_missing_date.py @@ -0,0 +1,15 @@ +from packageurl import PackageURL + +from fetchcode import package_util +from fetchcode.packagedcode_models import Package + + +def test_github_package_without_release_date(monkeypatch): + monkeypatch.setattr( + package_util.utils, "fetch_github_tags_gql", lambda purl: [("v1.2.3", None)] + ) + purl = PackageURL("github", "example", "project") + packages = list(package_util.get_github_packages(purl, None, None, Package(**purl.to_dict()))) + assert len(packages) == 1 + assert packages[0].version == "1.2.3" + assert packages[0].release_date is None From 52962a0114274436984a4e70f2d76c64e39f9aea Mon Sep 17 00:00:00 2001 From: Ali Zulfiqar Date: Sat, 5 Sep 2026 22:30:06 +0500 Subject: [PATCH 2/2] Address review feedback and strengthen regression coverage Signed-off-by: Ali Zulfiqar --- tests/test_github_missing_date.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test_github_missing_date.py b/tests/test_github_missing_date.py index af7cc95..f0fecc3 100644 --- a/tests/test_github_missing_date.py +++ b/tests/test_github_missing_date.py @@ -1,3 +1,19 @@ +# fetchcode is a free software tool from nexB Inc. and others. +# Visit https://github.com/aboutcode-org/fetchcode for support and download. + +# Copyright (c) nexB Inc. and others. All rights reserved. +# http://nexb.com and http://aboutcode.org + +# This software is licensed under the Apache License version 2.0. + +# You may not use this software except in compliance with the License. +# You may obtain a copy of the License at: +# http://apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software distributed +# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +# CONDITIONS OF ANY KIND, either express or implied. See the License for the +# specific language governing permissions and limitations under the License. + from packageurl import PackageURL from fetchcode import package_util