Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Commit

Permalink
Make to choose giphy randomly (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
micnncim authored Oct 14, 2019
1 parent 7ec8019 commit f104c07
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/action-lgtm-reaction/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ package main
import (
"context"
"fmt"
"math/rand"
"os"
"strconv"
"strings"
"time"

"github.com/micnncim/action-lgtm-reaction/pkg/giphy"
"github.com/micnncim/action-lgtm-reaction/pkg/github"
Expand Down Expand Up @@ -55,7 +57,11 @@ func main() {
os.Exit(1)
}
ctx := context.Background()
comment := giphies[0].GIFURLInMarkdownStyle()

rand.Seed(time.Now().Unix())
index := rand.Intn(len(giphies))
comment := giphies[index].GIFURLInMarkdownStyle()

if err := githubClient.CreateIssueComment(ctx, owner, repo, number, comment); err != nil {
os.Exit(1)
}
Expand Down

0 comments on commit f104c07

Please sign in to comment.