From 7bc929cabfa4c1ceee0d1d4a516c193e047b319b Mon Sep 17 00:00:00 2001 From: Neal Date: Thu, 22 Aug 2024 13:31:27 -0700 Subject: [PATCH] update 10 --- reports/sdks.go | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/reports/sdks.go b/reports/sdks.go index 628fe72..c16dfee 100644 --- a/reports/sdks.go +++ b/reports/sdks.go @@ -113,6 +113,11 @@ var ( func GetAllReports() ([]Report, error) { ctx := context.Background() + err := CheckSubmoduleStatus2(context.Background()) + if err != nil { + fmt.Println("Error checking submodufle status: %v", err) + } + var reports []Report for _, sdk := range SDKs { slog.Info("Processing: " + sdk.Name) @@ -152,11 +157,6 @@ func GetAllReports() ([]Report, error) { fmt.Println("No Test Vector Suites found.") } - err = CheckSubmoduleStatus2(context.Background()) - if err != nil { - fmt.Println("Error checking submodule status: %v", err) - } - var report Report if sdk.Name == "web5-rs" { report, err = sdk.buildReportWeb5Rs(web5TestVectorSuites) @@ -346,6 +346,11 @@ func CheckSubmoduleStatus2(ctx context.Context) error { } for _, sdk := range SDKs { + + // default values + sdk.SubmoduleCommit = "-" + sdk.SubmoduleCommitBehind = -1 + owner, repo, _ := strings.Cut(sdk.Repo, "/") // Determine the submodule path based on the SDK type @@ -369,17 +374,19 @@ func CheckSubmoduleStatus2(ctx context.Context) error { submoduleCommitSHA := *submoduleFileContent.SHA fmt.Printf("Current submodule commit for %s in %s: %s \n", submodulePath, sdk.Repo, submoduleCommitSHA) + sdk.SubmoduleCommit = submoduleCommitSHA // Check how far behind the submodule commit is from the allCommits counter := 0 found := false for _, commit := range allCommits { - counter++ if *commit.SHA == submoduleCommitSHA { fmt.Printf("%s is behind by %d commits in %s \n", sdk.Repo, counter, submodulePath) + sdk.SubmoduleCommitBehind = counter found = true break } + counter++ } if !found {