Answer a question

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

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.

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?

Answers

where do I perform such status checks

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

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.


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:

  • we're looking up the full name of the repository
  • we're looking up the last SHA of the pull request
  • we're setting the status to "success"
Logo

ModelScope旨在打造下一代开源的模型即服务共享平台,为泛AI开发者提供灵活、易用、低成本的一站式模型服务产品,让模型应用更简单!

更多推荐