Skip to content

Commit e320d18

Browse files
alonbllucamilanesio
authored andcommitted
workflow: support no change of label
Support a simple comment that does not change the scores by setting label to null. Signed-off-by: Alon Bar-Lev <[email protected]>
1 parent fc0bc91 commit e320d18

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ multi-branch pipeline job execution.
4444
Parameters:
4545

4646
- ```label```
47-
The review label to add to the Gerrit change.
47+
If non-null, the review label to add to the Gerrit change.
4848
Default: 'Verified'.
4949

5050
- ```score```

src/main/java/jenkins/plugins/gerrit/workflow/GerritReviewStep.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,16 @@ protected Void run() throws Exception {
7171

7272
String credentialsId = envVars.get("GERRIT_CREDENTIALS_ID");
7373
String gerritApiUrl = envVars.get("GERRIT_API_URL");
74-
String notify = score < 0 ? ", \"notify\" : \"OWNER\"" : "";
75-
String jsonPayload =
76-
"{\"labels\":{\""
74+
String labels = label == null ? "" :
75+
"\"labels\":{\""
7776
+ label
7877
+ "\":"
7978
+ score
80-
+ "},"
79+
+ "},";
80+
String notify = score < 0 ? ", \"notify\" : \"OWNER\"" : "";
81+
String jsonPayload =
82+
"{"
83+
+ labels
8184
+ " \"message\": \""
8285
+ message
8386
+ "\""

0 commit comments

Comments
 (0)