This commit is contained in:
parent
8ff3cc5034
commit
f9c27b01a8
3 changed files with 6 additions and 20 deletions
2
go.mod
2
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
|
||||
|
|
|
|||
7
main.go
7
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")
|
||||
|
|
|
|||
17
main_test.go
17
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": "<b style=\"color: green;\">SUCCESS</b>"
|
||||
}
|
||||
},
|
||||
{
|
||||
"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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue