github_webhook 0.5.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +9 -9
- data/README.md +2 -2
- data/lib/github_webhook/processor.rb +2 -2
- data/lib/github_webhook/version.rb +1 -1
- data/spec/github_webhook/processor_spec.rb +4 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1864577995ba631fa6ffb8e954f6aa64e54d3da
|
4
|
+
data.tar.gz: 85143e0aacc3bd846970acdfc9d7000d382d7df7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73ec61199f6fd67d0ecbe3609188032bf725f6a630f5c7f2ba4ca697d6a0d3bb628648ac4f9ef46da22eddc57ad074e6f6a41d047a9c5d91b6a04bda082079c0
|
7
|
+
data.tar.gz: 96d7b93e73a037e6628bcb50f66d8f8fc48c0e2ae9f98c3b71bf3754c1c16d2c584aef00e3c9636b2c7aa45c47b9c32c3b957e3a529998b602ad0d6c3ead7e48
|
data/Gemfile.lock
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
github_webhook (0.
|
5
|
-
activesupport (
|
6
|
-
rack (
|
4
|
+
github_webhook (1.0.0)
|
5
|
+
activesupport (>= 4)
|
6
|
+
rack (>= 1.3)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activesupport (
|
11
|
+
activesupport (5.0.0.1)
|
12
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
13
|
i18n (~> 0.7)
|
13
|
-
json (~> 1.7, >= 1.7.7)
|
14
14
|
minitest (~> 5.1)
|
15
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
16
15
|
tzinfo (~> 1.1)
|
17
16
|
codeclimate-test-reporter (0.4.8)
|
18
17
|
simplecov (>= 0.7.1, < 1.0.0)
|
18
|
+
concurrent-ruby (1.0.2)
|
19
19
|
diff-lcs (1.2.5)
|
20
20
|
docile (1.1.5)
|
21
21
|
i18n (0.7.0)
|
22
22
|
json (1.8.3)
|
23
|
-
minitest (5.
|
24
|
-
rack (
|
23
|
+
minitest (5.9.0)
|
24
|
+
rack (2.0.1)
|
25
25
|
rake (10.3.1)
|
26
26
|
rspec (2.14.1)
|
27
27
|
rspec-core (~> 2.14.0)
|
@@ -51,4 +51,4 @@ DEPENDENCIES
|
|
51
51
|
rspec (~> 2.14)
|
52
52
|
|
53
53
|
BUNDLED WITH
|
54
|
-
1.
|
54
|
+
1.12.5
|
data/README.md
CHANGED
@@ -13,7 +13,7 @@ to a [GitHub webhook](https://developer.github.com/webhooks/)
|
|
13
13
|
Add this line to your application's Gemfile:
|
14
14
|
|
15
15
|
```ruby
|
16
|
-
gem 'github_webhook', '~> 0.
|
16
|
+
gem 'github_webhook', '~> 0.5.0'
|
17
17
|
```
|
18
18
|
|
19
19
|
And then execute:
|
@@ -79,7 +79,7 @@ callback_url = "yourdomain.com/github_webhooks"
|
|
79
79
|
webhook_secret = "a_gr34t_s3cr3t" # Must be set after that in ENV['GITHUB_WEBHOOK_SECRET']
|
80
80
|
|
81
81
|
# Create the WebHook
|
82
|
-
client.subscribe "https://github.com/#{repo}/events/push.json", callback_url,
|
82
|
+
client.subscribe "https://github.com/#{repo}/events/push.json", callback_url, webhook_secret
|
83
83
|
```
|
84
84
|
|
85
85
|
The secret is set at the webhook creation. Store it in an environment variable,
|
@@ -2,8 +2,8 @@ module GithubWebhook::Processor
|
|
2
2
|
extend ActiveSupport::Concern
|
3
3
|
|
4
4
|
included do
|
5
|
-
|
6
|
-
|
5
|
+
before_action :authenticate_github_request!, only: :create
|
6
|
+
before_action :check_github_event!, only: :create
|
7
7
|
end
|
8
8
|
|
9
9
|
class SignatureError < StandardError; end
|
@@ -16,8 +16,8 @@ module GithubWebhook
|
|
16
16
|
### Helpers to mock ActionController::Base behavior
|
17
17
|
attr_accessor :request, :pushed
|
18
18
|
|
19
|
-
def self.
|
20
|
-
def self.
|
19
|
+
def self.skip_before_action(*args); end
|
20
|
+
def self.before_action(*args); end
|
21
21
|
def head(*args); end
|
22
22
|
###
|
23
23
|
|
@@ -54,7 +54,7 @@ module GithubWebhook
|
|
54
54
|
controller.request.headers['X-Hub-Signature'] = "sha1=52b582138706ac0c597c315cfc1a1bf177408a4d"
|
55
55
|
controller.request.headers['X-GitHub-Event'] = 'push'
|
56
56
|
controller.request.headers['Content-Type'] = 'application/json'
|
57
|
-
controller.send :authenticate_github_request! # Manually as we don't have the
|
57
|
+
controller.send :authenticate_github_request! # Manually as we don't have the before_action logic in our Mock object
|
58
58
|
controller.create
|
59
59
|
expect(controller.pushed).to eq "bar"
|
60
60
|
end
|
@@ -65,7 +65,7 @@ module GithubWebhook
|
|
65
65
|
controller.request.headers['X-Hub-Signature'] = "sha1=6986874ecdf710b04de7ef5a040161d41687407a"
|
66
66
|
controller.request.headers['X-GitHub-Event'] = 'push'
|
67
67
|
controller.request.headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
68
|
-
controller.send :authenticate_github_request! # Manually as we don't have the
|
68
|
+
controller.send :authenticate_github_request! # Manually as we don't have the before_action logic in our Mock object
|
69
69
|
controller.create
|
70
70
|
expect(controller.pushed).to eq "bar"
|
71
71
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github_webhook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastien Saunier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
version: '0'
|
135
135
|
requirements: []
|
136
136
|
rubyforge_project:
|
137
|
-
rubygems_version: 2.
|
137
|
+
rubygems_version: 2.6.6
|
138
138
|
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: Process GitHub Webhooks in your Rails app (Controller mixin)
|