为GitHub拉取请求添加验证检查 [英] Add validation checks for GitHub pull requests

查看:207
本文介绍了为GitHub拉取请求添加验证检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为主分支的每个PR添加一个验证检查到我的GitHub仓库(用于与我们的Bamboo CI集成)。

也就是说,向master分支的每次推送都会触发一个Bamboo构建,它必须在推送准备合并之前通过。



在repo的设置页面的支持master的分支 - >需要状态检查才能合并之前传送

我没有看到Bamboo构建的状态检查选项。我如何添加它?



我已经在Webhooks&服务部分的回购设置,并测试该服务可以通过测试服务按钮正确触发Bamboo构建。

解决方案

有一个老竹插件 GitHub状态。您可以尝试安装它。



如果没有帮助,总会有一个选项可以添加一些自定义脚本,它们会通过 GitHub Status API



事实上,它非常简单,只需要为您的回购制作 POST 请求:

  POST /回购/:所有者/:回购/​​状态/:SHA 
{
的状态: 成功,
的target_url:https://开头例子.com / build / status,
description:构建成功!,
context:持续集成/ jenkins
}

其中:sha 是触发构建的提交。它存储在环境变量 {bamboo.planRepository.revision} 中。


I'd like to add a validation check on every PR for the master branch to my GitHub repo (for integration with our Bamboo CI).

That is, each push to the master branch will trigger a Bamboo build, which must pass prior to that push being ready to merge.

On the repo's Settings page under "Branch protection for master"-->"Require status checks to pass before merging"

I don't see a status check option for the Bamboo build. How can I add it?

I've already added the Bamboo service in the Webhooks & Services section of the repo settings, and tested that the service can properly trigger a Bamboo build with the "Test service" button.

解决方案

There is an old Bamboo plugin GitHub Status. You can try to install it.

If that doesn't help, there is always an option to add a couple of custom scripts which will post statuses via GitHub Status API.

In fact, it's very simple, all you need is just to make a POST request to your repo:

POST /repos/:owner/:repo/statuses/:sha
{
  "state": "success",
  "target_url": "https://example.com/build/status",
  "description": "The build succeeded!",
  "context": "continuous-integration/jenkins"
}

where :sha is a commit which triggered the build. It's stored in environment variable {bamboo.planRepository.revision}.

这篇关于为GitHub拉取请求添加验证检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆