• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

wietze/github-checks-api: A lightweight python3 implementation of the GitHub Che ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

wietze/github-checks-api

开源软件地址:

https://github.com/wietze/github-checks-api

开源编程语言:

Python 100.0%

开源软件介绍:

github-checks-api

GitHub Checks allows you to quickly see the results of your CI tests from GitHub.

This is a simple, light-weight python implementation of the GitHub Checks API.

Examples

Once you have completed all the installation steps, here are a few examples of what your Checks implementation could look like:

Automatically run Checks for new commits:

Annotate files with messages explaining why they failed tests:

Installation

Note that you need a self-hosted server that will run your CI logic.

1: Creating a new GitHub app

In GitHub, do the following:

  1. Click your profile in the right top corner, click Settings, click Developers Settings, click GitHub Apps and click New GitHub App.

  2. Add a name and homepage URL (any URL will do). For User authorization callback URL and Webhook URL, use the server address you'll be using, with /hook at the end of the address.

  3. Generate a strong, random secret and set it as Webhook secret (optional). While optional in GitHub, this project won't work without one.

  4. Under Permissions, set the following:

    Name Permission
    Checks Read & write
    Repository contents Read
    Repository metadata Read
  5. Under Subscribe to events, tick Check runs.

  6. Click Create GitHub App.

  7. If the creation was successful, you'll see an overview of your app. Copy the App ID as you'll need it for setting up the script.

  8. Scroll to the bottom of the page to generate a private key. Save the file as pk.pem, as you'll need it for setting up the script.

2: Setting up the server

The server will run on port 443, using a simple Python 3 Flask server.

  1. Install all dependencies by running the following command:

    pip install -r requirements.txt
  2. To create a locally signed SSL certificate, run the followingin the same folder as server.py:

    openssl req -x509 -newkey rsa:4096 -nodes -out cert.pem -keyout key.pem -days 365
  3. Copy pk.pem (see 'Creating a GitHub app' section) to the same folder as server.py.

  4. Update example.py to set the correct App ID. If you're using GitHub Enterprise, also update the base_api parameter.

3: Running the server

Run the server as follows:

GITHUB_WEBHOOK_SECRET={{your_secret_here}} sudo -E python3 server.py

Make sure you replace {{your_secret_here}} with your webhook secret set in GitHub (see 'Creating a GitHub app' section). You might want to consider changing port 443 to something else so that server.py doesn't have to run using sudo.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
guillep/GitHub: Pharo Smalltalk bindings to the GitHub API发布时间:2022-06-13
下一篇:
@tuyapi/cloud 0.3.2 | Documentation发布时间:2022-06-13
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap