Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arrays 截断github注释,仅输出到github提交注释前20个错误_Arrays_Json_Git_Jenkins Pipeline_Git Commit - Fatal编程技术网

Arrays 截断github注释,仅输出到github提交注释前20个错误

Arrays 截断github注释,仅输出到github提交注释前20个错误,arrays,json,git,jenkins-pipeline,git-commit,Arrays,Json,Git,Jenkins Pipeline,Git Commit,Github对注释有最大字符限制(大约65000个字符) 这太长了,不太有用,但我们正在生成一些比这更长的输出 所需功能: 仅输出到github提交注释前20个错误 如果超过20个错误,则添加一条消息(粗体),说明“存在更多错误消息,请参阅splunk报告” 警告也一样 代码在这里 git_comment=git_comment+'\n### ERRORS ('+errors.size()+')\n' errors.each{ git_comment=git_comment+'\n'

Github对注释有最大字符限制(大约65000个字符)

这太长了,不太有用,但我们正在生成一些比这更长的输出

所需功能:

  • 仅输出到github提交注释前20个错误
  • 如果超过20个错误,则添加一条消息(粗体),说明“存在更多错误消息,请参阅splunk报告”
  • 警告也一样
代码在这里

  git_comment=git_comment+'\n### ERRORS ('+errors.size()+')\n'
  errors.each{ git_comment=git_comment+'\n'+it }
  git_comment=git_comment+'\n### WARNINGS ('+warnings.size()+')\n'
  warnings.each{ git_comment=git_comment+'\n'+it }
  git_comment=git_comment.replaceAll("'","")

事实上,我收到了200多条错误消息。我只想输出20条错误消息。此外,如果超过20个错误,则添加一条消息(粗体),说明“存在更多错误消息,请参阅splunk报告”


为了使它只输出20个错误,我想知道代码git_comment部分中errors.size()和warnings.size()的语法。

我不确定您的问题是什么。你的代码是否有效?有什么问题吗?事实上,我收到了200多条错误消息要提交给GitHub。我只想输出20条错误消息。另外,如果超过20个错误添加了一条消息(粗体),上面写着“存在更多错误消息,请参阅splunk report”以使其仅输出20个错误,我需要git_注释中errors.size()和warnings.size()的语法