diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..0f4cd25 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +.github +.gitignore +action.yml +docker-slimbuild +main_test.go diff --git a/main.go b/main.go index 1a6bc87..fa3fe7d 100644 --- a/main.go +++ b/main.go @@ -64,8 +64,11 @@ func main() { status := githubactions.GetInput("status") if status == "" { - githubactions.Fatalf("Missing input 'status'") - os.Exit(1) + githubactions.Infof("[INFO] Missing input 'status', trying default") + var ok bool + if status, ok = os.LookupEnv("JOB_STATUS"); ok { + githubactions.Infof("[INFO] found job status") + } } data.Status = status @@ -162,13 +165,6 @@ func card(d templateData) ([]byte, error) { bdy += fmt.Sprintf("Branch: %s
", ref) } - if d.Status == "" { - stat, ok := os.LookupEnv("JOB_STATUS") - if ok { - d.Status = stat - } - } - if d.Status != "" { bdy += fmt.Sprintf("Build Status: %s", d.Status) } diff --git a/message_old.tpl b/message_old.tpl deleted file mode 100644 index 9a57795..0000000 --- a/message_old.tpl +++ /dev/null @@ -1,35 +0,0 @@ -{ - "cards": [ - { - "header": { - "title": "{{ .Title }}", - "subtitle": "{{ .SubTitle }}", - "imageUrl": "{{ .IconUrl }}", - "imageStyle": "IMAGE" - }, - "sections": [ - { - "widgets": [ - { - "textParagraph": { - "text": "Project: {{ .Project }}
Commit-id: {{ .Commit }}
Branch: {{ .Branch }}
Build Status: {{ .Status }}" - }, - "buttons": [ - { - "textButton": { - "text": "Job Details", - "onClick": { - "openLink": { - "url": "{{ .GitURL }}/{{ .Project }}/actions/runs/{{ .ActionID }}" - } - } - } - } - ] - } - ] - } - ] - } - ] -} diff --git a/sample.tpl b/sample.tpl deleted file mode 100644 index 4fbe3bf..0000000 --- a/sample.tpl +++ /dev/null @@ -1,78 +0,0 @@ -{ - "cardsV2": [ - { - "cardId": "unique-card-id", - "card": { - "header": { - "title": "Sasha", - "subtitle": "Software Engineer", - "imageUrl": - "https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png", - "imageType": "CIRCLE", - "imageAltText": "Avatar for Sasha" - }, - "sections": [ - { - "header": "Contact Info", - "collapsible": true, - "uncollapsibleWidgetsCount": 1, - "widgets": [ - { - "decoratedText": { - "startIcon": { - "knownIcon": "EMAIL" - }, - "text": "sasha@example.com" - } - }, - { - "decoratedText": { - "startIcon": { - "knownIcon": "PERSON" - }, - "text": "Online" - } - }, - { - "decoratedText": { - "startIcon": { - "knownIcon": "PHONE" - }, - "text": "+1 (555) 555-1234" - } - }, - { - "buttonList": { - "buttons": [ - { - "text": "Share", - "onClick": { - "openLink": { - "url": "https://example.com/share" - } - } - }, - { - "text": "Edit", - "onClick": { - "action": { - "function": "goToView", - "parameters": [ - { - "key": "viewType", - "value": "EDIT" - } - ] - } - } - } - ] - } - } - ] - } - ] - } - } - ] -}