File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
src/main/java/org/jenkinsci/plugins/pipeline/github Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 3333import java .util .List ;
3434import java .util .Map ;
3535import java .util .Objects ;
36+ import java .util .Optional ;
3637import java .util .stream .Stream ;
3738import java .util .stream .StreamSupport ;
3839
@@ -420,12 +421,10 @@ public void setMaintainerCanModify(final boolean value) {
420421 }
421422
422423 @ Whitelisted
423- public void setLabels (List <String > labels ) {
424- if (labels == null ) {
425- labels = Collections .emptyList ();
426- }
424+ public void setLabels (final List <String > labels ) {
427425 try {
428- issueService .setLabels (base , pullRequest .getNumber (), labels );
426+ issueService .setLabels (base , pullRequest .getNumber (),
427+ Optional .ofNullable (labels ).orElseGet (Collections ::emptyList ));
429428 } catch (final IOException e ) {
430429 throw new UncheckedIOException (e );
431430 }
@@ -451,6 +450,11 @@ public void deleteReviewRequests(final List<String> reviewers) {
451450 }
452451 }
453452
453+ @ Whitelisted
454+ public void addLabel (final String label ) {
455+ addLabels (Collections .singletonList (label ));
456+ }
457+
454458 @ Whitelisted
455459 public void addLabels (final List <String > labels ) {
456460 Objects .requireNonNull (labels , "labels is a required argument" );
You can’t perform that action at this time.
0 commit comments