Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions cmd/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,27 @@ func getToolShortName(fullName string) string {
func getRelativePath(baseDir string, fullURI string) string {

localPath := fullURI

// GitHub Actions workaround
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" {
// 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
Expand Down