ProcessGithubEvent processes a Github event (usually received over webhooks). After validating that the event is a valid Github event, it moves further processing to the background and returns a nil error.
(ctx context.Context, rawEvent any)
| 344 | // ProcessGithubEvent processes a Github event (usually received over webhooks). |
| 345 | // After validating that the event is a valid Github event, it moves further processing to the background and returns a nil error. |
| 346 | func (s *Service) ProcessGithubEvent(ctx context.Context, rawEvent any) error { |
| 347 | switch event := rawEvent.(type) { |
| 348 | // Triggered on push to repository |
| 349 | case *github.PushEvent: |
| 350 | return s.processGithubPush(ctx, event) |
| 351 | // Triggered during first installation of app to an account (org or user) or one or more repos |
| 352 | case *github.InstallationEvent: |
| 353 | return s.processGithubInstallationEvent(ctx, event) |
| 354 | // Triggered when new repos are added to the account (org or user), and the installation has full access to account |
| 355 | case *github.InstallationRepositoriesEvent: |
| 356 | return s.processGithubInstallationRepositoriesEvent(ctx, event) |
| 357 | default: |
| 358 | return nil |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | func (s *Service) processGithubPush(ctx context.Context, event *github.PushEvent) error { |
| 363 | // Find Rill project matching the repo that was pushed to |
no test coverage detected