update new version
This commit is contained in:
parent
0f1d4a1618
commit
d72cd9bd59
3 changed files with 65 additions and 9 deletions
58
main.go
58
main.go
|
|
@ -9,18 +9,68 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
msg := githubactions.GetInput("msg")
|
||||
project := githubactions.GetInput("project")
|
||||
if msg == "" {
|
||||
githubactions.Fatalf("Missing input 'msg'")
|
||||
githubactions.Fatalf("Missing input 'project'")
|
||||
}
|
||||
commit := githubactions.GetInput("commit")
|
||||
if msg == "" {
|
||||
githubactions.Fatalf("Missing input 'commit'")
|
||||
}
|
||||
branch := githubactions.GetInput("branch")
|
||||
if msg == "" {
|
||||
githubactions.Fatalf("Missing input 'branch'")
|
||||
}
|
||||
status := githubactions.GetInput("status")
|
||||
if msg == "" {
|
||||
githubactions.Fatalf("Missing input 'status'")
|
||||
}
|
||||
actionid := githubactions.GetInput("actionid")
|
||||
if msg == "" {
|
||||
githubactions.Fatalf("Missing input 'actionid'")
|
||||
}
|
||||
webhook := githubactions.GetInput("webhook")
|
||||
if webhook == "" {
|
||||
githubactions.Fatalf("Missing input 'webshook'")
|
||||
}
|
||||
|
||||
fmt.Println("URL:> ", webhook)
|
||||
|
||||
var jsonStr = []byte(fmt.Sprintf("{'text' : '%s'}", msg))
|
||||
data = `{
|
||||
"cards": [
|
||||
{
|
||||
"header": {
|
||||
"title": "GitHub Action",
|
||||
"subtitle": "Build Job",
|
||||
"imageUrl": "https://github.githubassets.com/images/modules/logos_page/Octocat.png",
|
||||
"imageStyle": "IMAGE"
|
||||
},
|
||||
"sections": [
|
||||
{
|
||||
"widgets": [
|
||||
{
|
||||
"textParagraph": {
|
||||
"text": "<b>Project:</b> %s<br><b>Commit-id:</b> <font color=\"#FF0000\">%s</font><br><b>Branch:</b> <font color=\"#00FF00f\">%s</font><br><b>Build Status:</b> <font color=\"#0000ff\">%s</font>"
|
||||
},
|
||||
"buttons": [
|
||||
{
|
||||
"textButton": {
|
||||
"text": "Job Details",
|
||||
"onClick": {
|
||||
"openLink": {
|
||||
"url": "https://github.com/DTherHtun/web-app-flux/runs/%s"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}`
|
||||
var jsonStr = []byte(fmt.Sprintf(data, project, commit, branch, status, actionid ))
|
||||
req, err := http.NewRequest("POST", webhook, bytes.NewBuffer(jsonStr))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue