From 25716ef0f9bf9336ef2064d7aaf1e1f7699634bb Mon Sep 17 00:00:00 2001 From: DMarinhoCodacy Date: Thu, 29 Jan 2026 15:43:27 +0000 Subject: [PATCH 1/3] fix localPath when run in github actions --- cmd/upload.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/upload.go b/cmd/upload.go index 261b313..c5df90c 100644 --- a/cmd/upload.go +++ b/cmd/upload.go @@ -71,11 +71,16 @@ func getToolShortName(fullName string) string { func getRelativePath(baseDir string, fullURI string) string { localPath := fullURI + // GitHub Actions workaround + if strings.Contains(baseDir, "/home/runner/work/") { + localPath = filepath.Join(baseDir, fullURI) + } u, err := url.Parse(fullURI) if err == nil && u.Scheme == "file" { // url.Path extracts the local path component correctly localPath = u.Path } + relativePath, err := filepath.Rel(baseDir, localPath) if err != nil { // Fallback to the normalized absolute path if calculation fails From 3b7877fcb8ce83a28ae1e7d5e172bdc58ab68513 Mon Sep 17 00:00:00 2001 From: DMarinhoCodacy Date: Thu, 29 Jan 2026 17:22:35 +0000 Subject: [PATCH 2/3] improved github actions workarounds for different OS --- cmd/upload.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/cmd/upload.go b/cmd/upload.go index c5df90c..60711e9 100644 --- a/cmd/upload.go +++ b/cmd/upload.go @@ -71,9 +71,20 @@ func getToolShortName(fullName string) string { func getRelativePath(baseDir string, fullURI string) string { localPath := fullURI + // GitHub Actions workaround - if strings.Contains(baseDir, "/home/runner/work/") { - localPath = filepath.Join(baseDir, fullURI) + baseDirIndicators := []string{ + "/home/runner/work/", // Linux + "/Users/runner/work/", // macOS + "/__w/", // Docker Containers + "\\a\\", // Windows (D:\a\) + } + + for _, sub := range baseDirIndicators { + if strings.Contains(baseDir, sub) { + // We are likely in a GitHub Runner + localPath = filepath.Join(baseDir, fullURI) + } } u, err := url.Parse(fullURI) if err == nil && u.Scheme == "file" { @@ -82,6 +93,7 @@ func getRelativePath(baseDir string, fullURI string) string { } relativePath, err := filepath.Rel(baseDir, localPath) + fmt.Println(baseDir, localPath) if err != nil { // Fallback to the normalized absolute path if calculation fails fmt.Printf("Warning: Could not get relative path for '%s' relative to '%s': %v. Using absolute path.\n", localPath, baseDir, err) From 4677e0e866278d13288610c2279e3fc0c3cb7399 Mon Sep 17 00:00:00 2001 From: DMarinhoCodacy Date: Thu, 29 Jan 2026 17:24:15 +0000 Subject: [PATCH 3/3] delete println --- cmd/upload.go | 1 - 1 file changed, 1 deletion(-) diff --git a/cmd/upload.go b/cmd/upload.go index 60711e9..260d77c 100644 --- a/cmd/upload.go +++ b/cmd/upload.go @@ -93,7 +93,6 @@ func getRelativePath(baseDir string, fullURI string) string { } relativePath, err := filepath.Rel(baseDir, localPath) - fmt.Println(baseDir, localPath) if err != nil { // Fallback to the normalized absolute path if calculation fails fmt.Printf("Warning: Could not get relative path for '%s' relative to '%s': %v. Using absolute path.\n", localPath, baseDir, err)