Skip to content

Commit

Permalink
fix: re run all check
Browse files Browse the repository at this point in the history
  • Loading branch information
never112 committed Aug 30, 2024
1 parent c0ebeab commit 73e78d4
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
log.Errorf("process check run request event: %v", err)
}
}()
case *github.CheckSuiteEvent:
go func() {
if err := s.processCheckSuiteEvent(ctx, event); err != nil {
log.Errorf("process check run request event: %v", err)
}
}()
default:
log.Debugf("skipping event type %s\n", github.WebHookType(r))
}
Expand All @@ -153,6 +159,18 @@ func (s *Server) processCheckRunRequestEvent(ctx context.Context, event *github.
return s.handle(ctx, &pevent)
}

func (s *Server) processCheckSuiteEvent(ctx context.Context, event *github.CheckSuiteEvent) error {
if event.GetAction() != "rerequested" {
log.Debugf("skipping action %s\n", event.GetAction())
return nil
}
pevent := github.PullRequestEvent{}
pevent.Repo = event.GetRepo()
pevent.PullRequest = event.GetCheckSuite().PullRequests[0]
pevent.Installation = event.GetInstallation()
return s.handle(ctx, &pevent)
}

func (s *Server) handle(ctx context.Context, event *github.PullRequestEvent) error {
var (
num = event.GetPullRequest().GetNumber()
Expand Down

0 comments on commit 73e78d4

Please sign in to comment.