File tree Expand file tree Collapse file tree 2 files changed +6
-14
lines changed
src/main/java/org/jenkinsci/plugins/pipeline/github Expand file tree Collapse file tree 2 files changed +6
-14
lines changed Original file line number Diff line number Diff line change @@ -36,20 +36,17 @@ private GitHubHelper() {
3636 // go away
3737 }
3838
39- public static List < String > getCollaborators (@ Nonnull final Job <?,?> job ) {
39+ public static Boolean isAuthorized (@ Nonnull final Job <?,?> job , @ Nonnull final String User ) {
4040 ExtendedGitHubClient client = getGitHubClient (job );
4141 RepositoryId repository = getRepositoryId (job );
4242 CollaboratorService collaboratorService = new CollaboratorService (client );
4343
4444 try {
45- return collaboratorService .getCollaborators (repository )
46- .stream ()
47- .map (User ::getLogin )
48- .collect (Collectors .toList ());
45+ return collaboratorService .isCollaborator (repository , User );
4946 } catch (final IOException e ) {
50- LOG .debug ("Received an exception while trying to retrieve the collaborators for the repository: {}" ,
51- repository , e );
52- return Collections . emptyList () ;
47+ LOG .debug ("Received an exception while trying to check if user {} is a collaborator of repository: {}" ,
48+ User , repository , e );
49+ return false ;
5350 }
5451 }
5552
Original file line number Diff line number Diff line change @@ -172,12 +172,7 @@ private void handleIssueComment(final GHSubscriberEvent event) {
172172 }
173173
174174 private boolean isAuthorized (final WorkflowJob job , final String commentAuthor ) {
175- return GitHubHelper .getCollaborators (job )
176- .stream ()
177- .filter (commentAuthor ::equals )
178- .findAny ()
179- .map (a -> Boolean .TRUE )
180- .orElse (Boolean .FALSE );
175+ return GitHubHelper .isAuthorized (job , commentAuthor );
181176 }
182177
183178 private boolean triggerMatches (final IssueCommentTrigger trigger ,
You can’t perform that action at this time.
0 commit comments