diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 4207de22..cfdc62ec 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,5 +1,15 @@ name: Go -on: push + +on: + push: + branches: + - v2 + pull_request: + branches: + - v2 + workflow_dispatch: + schedule: + - cron: "0 0 1 * *" jobs: diff --git a/service/webhook.go b/service/webhook.go index 6bd431cb..d1f8664f 100644 --- a/service/webhook.go +++ b/service/webhook.go @@ -127,7 +127,7 @@ func WebhookEventHandler(c echo.Context, reqBody, resBody []byte) { message += fmt.Sprintf("- 請求先グループ: %s\n", resApp.Group.Name) } - if resApp.Tags != nil && len(resApp.Tags) != 0 { + if len(resApp.Tags) != 0 { tags := lo.Map(resApp.Tags, func(tag *Tag, index int) string { return tag.Name }) @@ -188,7 +188,7 @@ func WebhookEventHandler(c echo.Context, reqBody, resBody []byte) { if resApp.Group != nil { message += fmt.Sprintf("- 関連するグループ: %s\n", resApp.Group.Name) } - if resApp.Tags != nil && len(resApp.Tags) != 0 { + if len(resApp.Tags) != 0 { tags := lo.Map(resApp.Tags, func(tag *Tag, index int) string { return tag.Name }) diff --git a/testutil/random/ramdom.go b/testutil/random/ramdom.go index f4c7de62..1b3645fc 100644 --- a/testutil/random/ramdom.go +++ b/testutil/random/ramdom.go @@ -20,39 +20,39 @@ func AlphaNumeric(t *testing.T, n int) string { return string(b) } -func Numeric(t *testing.T, max int) int { +func Numeric(t *testing.T, n int) int { t.Helper() - return rand.IntN(max) + return rand.IntN(n) } -func Numeric64(t *testing.T, max int64) int64 { +func Numeric64(t *testing.T, n int64) int64 { t.Helper() - return rand.Int64N(max) + return rand.Int64N(n) } -func AlphaNumericSlice(t *testing.T, length int, max int64) []string { +func AlphaNumericSlice(t *testing.T, length int, n int64) []string { t.Helper() slice := []string{} for range length { - slice = append(slice, AlphaNumeric(t, int(max))) + slice = append(slice, AlphaNumeric(t, int(n))) } return slice } -func NumericSlice(t *testing.T, length int, max int) []int { +func NumericSlice(t *testing.T, length int, n int) []int { t.Helper() slice := []int{} for range length { - slice = append(slice, Numeric(t, max)) + slice = append(slice, Numeric(t, n)) } return slice } -func Numeric64Slice(t *testing.T, length int, max int64) []int64 { +func Numeric64Slice(t *testing.T, length int, n int64) []int64 { t.Helper() slice := []int64{} for range length { - slice = append(slice, Numeric64(t, max)) + slice = append(slice, Numeric64(t, n)) } return slice }