adding log_level option

This commit is contained in:
2025-11-11 16:27:26 -05:00
parent a0e397a87f
commit 90d2037563
2 changed files with 15 additions and 4 deletions

View File

@@ -5,9 +5,10 @@ inputs:
description: "path to docker compose file"
required: true
default: "compose.yaml"
ignore:
description: "checks to ignore (doesn't work yet)"
show:
description: "what level of issues to show (all|fatal)"
required: false
default: "all"
outputs:
report:
description: "results of the scan"
@@ -16,4 +17,4 @@ runs:
image: Dockerfile
env:
COMPOSE_FILE_PATH: ${{ inputs.path }}
IGNORED_CHECKS: ${{ inputs.ignore }}
LOG_LEVEL: ${{ inputs.show }}

12
main.go
View File

@@ -96,10 +96,20 @@ func main() {
issues = append(issues, rprt)
}
//this is better printing, it should probably group up the port issues in a better printing. Not sure how
lvl := os.Getenv("LOG_LEVEL")
for _, p := range issues {
fmt.Println()
fmt.Println("----------------------------------------------------------------------------")
fmt.Println(p.Name)
for _, x := range p.Issues {
fmt.Println(*x)
if lvl == "all" {
fmt.Printf("\tsafe: %t\n\tlevel: %s\n\tMessages:\n\t\t%s\n\n", x.Safe, x.Level, strings.Join(x.Messages, "\n\t\t"))
} else if lvl == "fatal" {
if x.Level == issue.FATAL {
fmt.Printf("\tsafe: %t\n\tlevel: %s\n\tMessages:\n\t\t%s\n\n", x.Safe, x.Level, strings.Join(x.Messages, "\n\t\t"))
}
}
}
}
}