Skip to content

Commit f9e703b

Browse files
authored
Merge pull request #1 from github-developer-docs-samples/first-revision
Adding intial working version of checks ci server
2 parents f9da915 + 6dc7f4f commit f9e703b

File tree

8 files changed

+592
-1
lines changed

8 files changed

+592
-1
lines changed

.env-example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
GITHUB_PRIVATE_KEY=""
2+
GITHUB_APP_IDENTIFIER=
3+
GITHUB_WEBHOOK_SECRET=
4+
GITHUB_APP_USER_NAME=
5+
GITHUB_APP_USER_EMAIL=

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
.env

Gemfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
source 'http://rubygems.org'
2+
3+
gem 'sinatra', '~> 2.0'
4+
gem 'jwt', '~> 2.1'
5+
gem 'octokit', '~> 4.0'
6+
gem 'rubocop'
7+
gem 'dotenv'
8+
gem 'git'

Gemfile.lock

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
GEM
2+
remote: http://rubygems.org/
3+
specs:
4+
addressable (2.5.2)
5+
public_suffix (>= 2.0.2, < 4.0)
6+
ast (2.4.0)
7+
dotenv (2.5.0)
8+
faraday (0.15.3)
9+
multipart-post (>= 1.2, < 3)
10+
git (1.5.0)
11+
jaro_winkler (1.5.1)
12+
jwt (2.1.0)
13+
multipart-post (2.0.0)
14+
mustermann (1.0.3)
15+
octokit (4.13.0)
16+
sawyer (~> 0.8.0, >= 0.5.3)
17+
parallel (1.12.1)
18+
parser (2.5.3.0)
19+
ast (~> 2.4.0)
20+
powerpack (0.1.2)
21+
public_suffix (3.0.3)
22+
rack (2.0.6)
23+
rack-protection (2.0.4)
24+
rack
25+
rainbow (3.0.0)
26+
rubocop (0.60.0)
27+
jaro_winkler (~> 1.5.1)
28+
parallel (~> 1.10)
29+
parser (>= 2.5, != 2.5.1.1)
30+
powerpack (~> 0.1)
31+
rainbow (>= 2.2.2, < 4.0)
32+
ruby-progressbar (~> 1.7)
33+
unicode-display_width (~> 1.4.0)
34+
ruby-progressbar (1.10.0)
35+
sawyer (0.8.1)
36+
addressable (>= 2.3.5, < 2.6)
37+
faraday (~> 0.8, < 1.0)
38+
sinatra (2.0.4)
39+
mustermann (~> 1.0)
40+
rack (~> 2.0)
41+
rack-protection (= 2.0.4)
42+
tilt (~> 2.0)
43+
tilt (2.0.8)
44+
unicode-display_width (1.4.0)
45+
46+
PLATFORMS
47+
ruby
48+
49+
DEPENDENCIES
50+
dotenv
51+
git
52+
jwt (~> 2.1)
53+
octokit (~> 4.0)
54+
rubocop
55+
sinatra (~> 2.0)
56+
57+
BUNDLED WITH
58+
1.17.1

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,21 @@
1-
# building-a-checks-api-ci-server
1+
This is an example GitHub App that creates a CI server that runs CI tests using the GitHub [Checks API](https://developer.github.com/v3/checks/). You can follow the "[Building a Checks API CI server](https://developer.github.com/apps/quickstart-guide/building-a-checks-api-ci-server)" Quickstart guide on developer.github.com to learn how to build the app code in `server.rb`.
2+
3+
This project handles check run and check suite webhook events and uses the Octokit.rb library to make REST API calls. The CI test runs [RuboCop](https://rubocop.readthedocs.io/en/latest/) on all Ruby code in a repository and reports errors using the Checks API. This example project consists of two different servers:
4+
* `template_server.rb` (GitHub App template code)
5+
* `server.rb` (completed project)
6+
7+
To learn how to set up a template GitHub App, follow the "[Configuring a GitHub App](https://developer.github.com/apps/quickstart-guide/configuring-ast-github-app)" Quickstart guide on developer.github.com.
8+
9+
## Install
10+
11+
To run the code, make sure you have [Bundler](http://gembundler.com/) installed; then enter `bundle install` on the command line.
12+
13+
## Set environment variables
14+
15+
1. Create a copy of the `.env-example` file called `.env`.
16+
2. Add your GitHub App's private key, app ID, and webhook secret, app username, and app email to the `.env` file.
17+
18+
## Run the server
19+
20+
1. Run `ruby template_server.rb` or `ruby server.rb` on the command line.
21+
1. View the default Sinatra app at `localhost:3000`.

config.ru

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
require './server'
2+
run GHAapp

0 commit comments

Comments
 (0)