Skip to content
代码片段 群组 项目
提交 bed49308 编辑于 作者: Albert Salim's avatar Albert Salim
浏览文件

Add warning when Danger cannot post labels

上级 806407d3
No related branches found
No related tags found
无相关合并请求
...@@ -19,10 +19,17 @@ anything_to_post = status_report.values.any? { |data| data.any? } ...@@ -19,10 +19,17 @@ anything_to_post = status_report.values.any? { |data| data.any? }
return unless helper.ci? return unless helper.ci?
if project_helper.labels_to_add.any? def post_labels
gitlab.api.update_merge_request(gitlab.mr_json['project_id'], gitlab.api.update_merge_request(gitlab.mr_json['project_id'],
gitlab.mr_json['iid'], gitlab.mr_json['iid'],
add_labels: project_helper.labels_to_add.join(',')) add_labels: project_helper.labels_to_add.join(','))
rescue Gitlab::Error::Forbidden
labels = project_helper.labels_to_add.map { |label| %Q(~"#{label}") }
warn("This Merge Request needs to be labelled with #{labels.join(' ')}. Please request a reviewer or maintainer to add them.")
end
if project_helper.labels_to_add.any?
post_labels
end end
if anything_to_post if anything_to_post
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册