Skip to content

Commit

Permalink
Merge pull request #7001 from niveathika/main
Browse files Browse the repository at this point in the history
Improve Trivy badge to detect disabled action
  • Loading branch information
ThisaruGuruge authored Sep 16, 2024
2 parents 5133b03 + 387b406 commit a8f6737
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
3 changes: 2 additions & 1 deletion dashboard/constants.bal
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const BALLERINA_BOT_TOKEN = "BALLERINA_BOT_TOKEN";
// Misc
const ENCODING = "UTF-8";
const NABADGE = "https://img.shields.io/badge/-N%2FA-yellow";
const DISABLED_BADGE = "https://img.shields.io/badge/-disabled-red";
const MAX_LEVEL = 100;

// README Contents
Expand Down Expand Up @@ -71,7 +72,7 @@ const DESCRIPTION_LIBRARY_MODULES = "These modules are published under the `ball
const DESCRIPTION_EXTENDED_MODULES = "These modules are protocol modules that are not packed with the Ballerina distribution.";
const DESCRIPTION_HANDWRITTEN_CONNECTORS = "These are the handwritten Ballerina connector modules that are used to connect to third-party services. They are published under the `ballerinax` organization ";
const DESCRIPTION_GENERATED_CONNECTORS = "These are the generated Ballerina connector modules that are used to connect to third-party services. They are published under the `ballerinax` organization. The modules are generated using the Ballerina OpenAPI tool using the third-party service's OpenAPI definition. Since these are auto-generated, they only contain a smoke test suite rather than a comprehensive test suite. Due to this nature, the code coverage and load test results are not applicable for these modules. Some repositories such as `sap.s4hana.sales` contain multiple connectors which are highly co-related. These have multiple releases and thus not indicated here.";
const DESCRIPTION_DRIVER_MODULES = "These Ballerina modules bundle database drivers, making it easier to use Ballerina database connectors. They are published under the `ballerinax` organization. These modules only bundle drivers, so only build, latest release, and security checks are applicable to these modules.";
const DESCRIPTION_DRIVER_MODULES = "These Ballerina modules bundle database drivers, making it easier to use Ballerina database connectors. They are published under the `ballerinax` organization. Only daily build, latest release, and security checks are applicable to these modules.";
const DESCRIPTION_TOOLS = "These are the Ballerina CLI tools maintained by the Ballerina Library team.";

// Workflow files
Expand Down
19 changes: 14 additions & 5 deletions dashboard/github.bal
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,20 @@ isolated function getRepoBadges(Module module) returns RepoBadges|error {
};
}
if workflowFileName == WORKFLOW_TRIVY {
repoBadges.trivy = {
name: "Trivy",
badgeUrl: getBadgeUrl(moduleName, workflowFileName, defaultBranch),
htmlUrl: getWorkflowUrl(moduleName, workflowFileName)
};
string workflowUrl = getWorkflowUrl(moduleName, workflowFileName);
if workflow.state == "disabled_inactivity" {
repoBadges.trivy = {
name: "Trivy",
badgeUrl: DISABLED_BADGE,
htmlUrl: workflowUrl
};
} else {
repoBadges.trivy = {
name: "Trivy",
badgeUrl: getBadgeUrl(moduleName, workflowFileName, defaultBranch),
htmlUrl: workflowUrl
};
}
}
if workflowFileName == WORKFLOW_PROCESS_LOAD_TESTS {
repoBadges.loadTests = {
Expand Down

0 comments on commit a8f6737

Please sign in to comment.