diff --git a/dashboard/tests/utils_test.bal b/dashboard/tests/utils_test.bal index bd6343f2..adea82d4 100644 --- a/dashboard/tests/utils_test.bal +++ b/dashboard/tests/utils_test.bal @@ -2,6 +2,7 @@ import ballerina/test; const IO_MODULE = "module-ballerina-io"; const JAVA_ARRAYS_MODULE = "module-ballerina-jballerina.java.arrays"; +const GMAIL_MODULE = "module-ballerinax-googleapis.gmail"; @test:Config function getRepoLinkTest() { @@ -16,11 +17,13 @@ function getReleaseBadgeTest() { @test:Config function getBuildStatusBadgeTest() { test:assertEquals(getBuildStatusBadge(IO_MODULE, "master"), "[![Build](https://img.shields.io/github/actions/workflow/status/ballerina-platform/module-ballerina-io/build-timestamped-master.yml?branch=master&label=)](https://github.com/ballerina-platform/module-ballerina-io/actions/workflows/build-timestamped-master.yml)"); + test:assertEquals(getBuildStatusBadge(GMAIL_MODULE, "master"), "[![Build](https://img.shields.io/github/actions/workflow/status/ballerina-platform/module-ballerinax-googleapis.gmail/ci.yml?branch=master&label=)](https://github.com/ballerina-platform/module-ballerinax-googleapis.gmail/actions/workflows/ci.yml)" ); } @test:Config function getTrivyBadgeTest() { test:assertEquals(getTrivyBadge(IO_MODULE, "master"), "[![Trivy](https://img.shields.io/github/actions/workflow/status/ballerina-platform/module-ballerina-io/trivy-scan.yml?branch=master&label=)](https://github.com/ballerina-platform/module-ballerina-io/actions/workflows/trivy-scan.yml)"); + test:assertEquals(getTrivyBadge(GMAIL_MODULE, "master"), "[![Trivy](https://img.shields.io/badge/-N%2FA-yellow)](https://github.com/ballerina-platform/module-ballerinax-googleapis.gmail/actions/workflows/trivy-scan.yml)"); } @test:Config diff --git a/dashboard/utils.bal b/dashboard/utils.bal index 23638155..6cd5c471 100644 --- a/dashboard/utils.bal +++ b/dashboard/utils.bal @@ -17,6 +17,7 @@ import ballerina/http; import ballerina/regex; import ballerina/url; +import ballerina/io; function getDashboardRow(Module module, string level) returns string|error { string moduleName = module.name; @@ -60,6 +61,8 @@ function getBuildStatusBadge(string moduleName, string defaultBranch) returns st string workflowName = WORKFLOW_MASTER_BUILD; string workflowFileUrl = string `/${BALLERINA_ORG_NAME}/${moduleName}/master/.github/workflows/${workflowName}`; http:Response openUrlResponse = check openUrl(GITHUB_RAW_LINK, workflowFileUrl); + io:println(openUrlResponse.statusCode); + io:println(openUrlResponse.getTextPayload()); if openUrlResponse.statusCode == http:STATUS_NOT_FOUND { workflowName = WORKFLOW_MASTER_CI_BUILD; } @@ -73,6 +76,8 @@ function getTrivyBadge(string moduleName, string defaultBranch) returns string|e http:Response openUrlResponse = check openUrl(GITHUB_RAW_LINK, workflowFileUrl); string badgeUrl = getGithubBadgeUrl(moduleName, WORKFLOW_TRIVY, defaultBranch, ""); string repoUrl = string `${BALLERINA_ORG_URL}/${moduleName}/actions/workflows/${WORKFLOW_TRIVY}`; + io:println(openUrlResponse.statusCode); + io:println(openUrlResponse.getTextPayload()); if openUrlResponse.statusCode == http:STATUS_NOT_FOUND { badgeUrl = NABADGE; }