mirror of
https://github.com/jonathan-martz/pocketbase-php-sdk.git
synced 2026-04-03 07:27:42 +00:00
send mail when failed is bigger then 0
This commit is contained in:
10
mailer.go
10
mailer.go
@@ -68,6 +68,13 @@ func main() {
|
|||||||
log.Fatal("Counts field not found in PHPUnit output.")
|
log.Fatal("Counts field not found in PHPUnit output.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if 'fails' is greater than 0
|
||||||
|
fails, ok := counts["failed"].(float64)
|
||||||
|
if !ok {
|
||||||
|
log.Fatal("'fails' field not found in counts.")
|
||||||
|
}
|
||||||
|
|
||||||
|
if fails > 0 {
|
||||||
// Serialize the counts field to JSON for the email body
|
// Serialize the counts field to JSON for the email body
|
||||||
countsJSON, err := json.MarshalIndent(counts, "", " ")
|
countsJSON, err := json.MarshalIndent(counts, "", " ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -91,4 +98,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log.Println("Test results sent to", recipient)
|
log.Println("Test results sent to", recipient)
|
||||||
|
} else {
|
||||||
|
log.Println("No failures detected. No email sent.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user