如何在github仓库中执行状态检查 [英] How to perform status checks in github repository

查看:102
本文介绍了如何在github仓库中执行状态检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个GitHub存储库,其中使用受保护的分支.

I have a GitHub repository in which I protected one branch with the new feature of Protected Branches.

现在我的问题是我希望在系统中执行状态检查,然后提交并将其推送到GitHub存储库中.

Now my problem is that I wish to perform the status check in the system and then commit and push it to the GitHub repo.

问题:如何在其中执行此类状态检查,以及如何将状态检查已清除的消息发送到GitHub服务器?

Problem: where do I perform such status checks and how do I send the message to the GitHub server that the status checks have been cleared?

推荐答案

我在哪里执行此类状态检查

where do I perform such status checks

您在同一位置设置状态检查:设置/分支(选择您的分支)

In the same place you set up status checks: settings/branches (select your branch)

以及如何将状态检查已清除的消息发送到GitHub服务器

and how do I send the message to the GitHub server that the status checks have been cleared

当您从本地存储库推送到该分支时,这些检查会更新.

Those checks are updated when you push from your local repo to that branch.

要发送成功状态,您可以遵循构建CI服务器:它将使用状态API.
状态API 负责将提交与测试服务捆绑在一起,以便每个您所做的推送可以在GitHub拉取请求中进行测试和表示.

In order to send a success status, you can follow Building a CI server: it will use the Status API.
The Status API is responsible for tying together commits with a testing service, so that every push you make can be tested and represented in a GitHub pull request.

def process_pull_request(pull_request)
  @client.create_status(pull_request['base']['repo']['full_name'], pull_request['head']['sha'], 'pending')
  sleep 2 # do busy work...
  @client.create_status(pull_request['base']['repo']['full_name'], pull_request['head']['sha'], 'success')
  puts "Pull request processed!"
end

我们在这里做三件非常基本的事情:

We're doing three very basic things here:

  • 我们正在查找存储库的全名
  • 我们正在查找拉取请求的最后一个SHA
  • 我们将状态设置为成功"

这篇关于如何在github仓库中执行状态检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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