diff --git a/go.mod b/go.mod index 1333d6b..8e5d566 100644 --- a/go.mod +++ b/go.mod @@ -7,4 +7,4 @@ require ( github.com/sethvargo/go-githubactions v1.3.2 ) -require github.com/google/uuid v1.6.0 // indirect +require github.com/google/uuid v1.6.0 diff --git a/main.go b/main.go index 57082ca..1b77d1a 100644 --- a/main.go +++ b/main.go @@ -40,12 +40,7 @@ type templateData struct { func main() { data := templateData{} - u, err := uuid.NewUUID() - if err != nil { - githubactions.Fatalf("Error generating UUID: %v", err) - os.Exit(1) - } - data.CardID = u.String() + data.CardID = uuid.NewString() data.Add = "" author := githubactions.GetInput("author") diff --git a/main_test.go b/main_test.go index 0798bd4..5c04597 100644 --- a/main_test.go +++ b/main_test.go @@ -21,6 +21,7 @@ func Test_card(t *testing.T) { name: "test one", args: args{ d: templateData{ + CardID: "aed17996-84fc-45d5-9061-2c51535ae267", Title: "test", SubTitle: "first test", Author: "gotest", @@ -39,12 +40,13 @@ func Test_card(t *testing.T) { { "cardsV2": [ { - "cardId": "notify-123", + "cardId": "notify-aed17996-84fc-45d5-9061-2c51535ae267", "card": { "header": { "title": "test", "subtitle": "first test", "imageUrl": "https://github.githubassets.com/images/modules/logos_page/Octocat.png", + "imageAltText": "message avatar image", "imageType": "SQUARE" }, "sections": [ @@ -53,17 +55,6 @@ func Test_card(t *testing.T) { "collapsible": true, "uncollapsibleWidgetsCount": 2, "widgets": [ - -{ -"decoratedText": { -"startIcon": { - "materialIcon": { - "name": "check_circle" - } -}, -"text": "SUCCESS" -} -}, { "decoratedText": { "startIcon": { @@ -121,7 +112,7 @@ func Test_card(t *testing.T) { var wantJson any err = json.Unmarshal(tt.want, &wantJson) if err != nil { - t.Fatal(err) + t.Fatalf("error: %v\nsrc: %s", err, tt.want) } //if !reflect.DeepEqual(wantJson, gotJson) {