-
Notifications
You must be signed in to change notification settings - Fork 5
/
common.go
31 lines (27 loc) · 895 Bytes
/
common.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package resource
/**
Common functions
*/
import (
"encoding/json"
"log"
)
// print the request json coming in to "in|out|check"
func PrintDebugInput(s Source, obj any) {
if s.OdAdvanced.Debug {
jsonBytes, _ := json.Marshal(obj)
log.Printf("input jsonStr : %s\n", string(jsonBytes))
log.Printf("Debig Tip1: run this docker image locally: docker run -it --entrypoint=/bin/sh opendoor/telia-oss-github-pr-resource:dev\n")
log.Printf("Debug Tip2: save the above jsonStr to /tmp/request.json\n")
log.Printf("Debug Tip3: cd /opt/resource && cat /tmp/request.json | <./in . |./out .|./check>\n")
}
}
func PrintDebugOutput(s Source, obj any) {
if s.OdAdvanced.Debug {
jsonBytes, _ := json.Marshal(obj)
log.Printf("output jsonStr : %s\n", string(jsonBytes))
}
}
func SayThanks() {
log.Printf("Thanks for using Opendoor's https://github.com/opendoor-labs/github-pr-resource\n")
}