I have a gerrit jenkins suport. I am unable to find a solution in gerrit prolog documentation https://gerrit-review.googlesource.com/Documentation/prolog-cookbook.html
This code is working according to below scenario
1- When jenkins user give a -1 vote, It will disable the Submit button
2- When jenkins user gives +1 vote, it will enable the Submit button.
submit_rule(S) :-
gerrit:default_submit(X),
X =.. [submit | Ls],
add_non_author_approval(Ls, R),
S =.. [submit | R].
score(Category, Score) :-
gerrit:commit_label(label(Category, Score), user(1000002)).
add_non_author_approval(S1, S2) :-
gerrit:commit_label(label('Code-Review', 1), user(1000001)),
A = user(1000002),
gerrit:commit_label(label('Code-Review', 2), R),
R \= A, !,
S2 = [label('Non-Author-Code-Review', ok(R)) | S1].
add_non_author_approval(S1, [label('Non-Author-Code-Review', need(_)) | S1]).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.