From 89871742135e1ecc1ce387391c14cd64badedcd6 Mon Sep 17 00:00:00 2001 From: Arnout Engelen Date: Mon, 17 Jun 2024 15:26:50 +0200 Subject: [PATCH] Autodetect version tags Towards #2139. Still draft because it needs updates to the unit tests (/VCR) but I ran into problems with the chrome integration of the tests. Signed-off-by: Arnout Engelen --- app/lib/github_basic_detective.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/lib/github_basic_detective.rb b/app/lib/github_basic_detective.rb index 8d65886ed..ddac1c75e 100644 --- a/app/lib/github_basic_detective.rb +++ b/app/lib/github_basic_detective.rb @@ -20,6 +20,7 @@ class GithubBasicDetective < Detective OUTPUTS = %i[ name license discussion_status repo_public_status repo_track_status repo_distributed_status contribution_status implementation_languages + version_tags ].freeze # These are the 'correct' display case for SPDX for OSI-approved licenses. @@ -170,6 +171,17 @@ def analyze(_evidence, current) confidence: 3, explanation: 'GitHub API implementation language analysis' } + + # Check for tags + tag_data = client.tags fullname + tags = tag_data.map { |tag| tag[:name] } + if tags.any? { |tag| tag.match?(/^v?\d+\.\d+\.\d+$/) } + results[:version_tags] = { + value: version_tags, + confidence: 2, + explanation: 'GitHub tags' + } + end end results