Skip to content

Commit

Permalink
feat(pkg/reporter): make the pro reporter work also on other GitHub a…
Browse files Browse the repository at this point in the history
…ctions events (not only pull_request)

Signed-off-by: Leonardo Di Donato <[email protected]>
  • Loading branch information
leodido committed Jul 30, 2024
1 parent 178afa5 commit 3f03319
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/reporter/factory/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,10 @@ func Make(ctx context.Context, reportType cmd.ReportType) (r reporter.Reporter,
return nil, false, ErrReporterUnsupportedEnvironment
}

// This reporter doesn't run on forks at the moment
if info.IsGitHubPullRequest() {
if info.HasReadOnlyGitHubToken() {
return nil, false, ErrReporterOnFork
}
// This reporter doesn't run on fork's pull requests at the moment
// It can run on GitHub events other than pull_request tho since it only calls our core APIs
if info.HasReadOnlyGitHubToken() {
return nil, false, ErrReporterOnFork
}

r, err := pro.New(ctx, reporter.WithContinuousIntegrationInfo(info))
Expand All @@ -84,6 +83,7 @@ func Make(ctx context.Context, reportType cmd.ReportType) (r reporter.Reporter,
return nil, false, ErrReporterUnsupportedEnvironment
}

// This reporter can only work on pull requests because it comments on them (with a sticky comment)
if !env.IsGitHubPullRequest() {
return nil, false, ErrReporterNotOnPullRequest
}
Expand Down

0 comments on commit 3f03319

Please sign in to comment.