github_webhook 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +2 -0
- data/.travis.yml +7 -0
- data/Appraisals +11 -0
- data/Gemfile +2 -0
- data/README.md +14 -0
- data/Rakefile +3 -0
- data/gemfiles/rails_4.2.gemfile +7 -0
- data/gemfiles/rails_5.0.gemfile +7 -0
- data/gemfiles/rails_5.1.gemfile +7 -0
- data/github_webhook.gemspec +2 -1
- data/lib/github_webhook/processor.rb +11 -15
- data/lib/github_webhook/version.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- metadata +21 -4
- data/Gemfile.lock +0 -92
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b600d6f9819bb2733a770802f9b7d9bf3c6ce0494f5efd5331a3c837449138e9
|
4
|
+
data.tar.gz: 2508562d1d07536d4269a8d9a2887e11a5fb777d8def729e1a7874e04a818b23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bab9275ab482493469fff0e8b161d320626b514303e4370fff55929beb2ed30aac8f2eaf6c21410834f4c38d56c4e633e3ce7ef768a04c1cf1bae02a3f5e4413
|
7
|
+
data.tar.gz: 5359dd0bc8f338a19d95ca06f2b8c0c340f02f2ccd49aebae4d8eae7cce27a85dc8f300524551ee298a3cbe49e5f6aec71ad4a87f4cebfd7dd44d6101386074e
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -2,6 +2,13 @@ language: ruby
|
|
2
2
|
rvm:
|
3
3
|
- 2.4.2
|
4
4
|
- 2.3.5
|
5
|
+
- 2.2.8
|
6
|
+
gemfile:
|
7
|
+
- gemfiles/rails_4.2.gemfile
|
8
|
+
- gemfiles/rails_5.0.gemfile
|
9
|
+
- gemfiles/rails_5.1.gemfile
|
5
10
|
addons:
|
6
11
|
code_climate:
|
7
12
|
repo_token: 50425d682162d68af0b65bd9e5160da8337d2159fc3ebc00d2a5b14386548ac5
|
13
|
+
after_success:
|
14
|
+
- bundle exec codeclimate-test-reporter
|
data/Appraisals
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -93,3 +93,17 @@ You can have an overview of your webhooks at the following URL:
|
|
93
93
|
```
|
94
94
|
https://github.com/:username/:repo/settings/hooks
|
95
95
|
```
|
96
|
+
|
97
|
+
## Contributing
|
98
|
+
|
99
|
+
### Specs
|
100
|
+
|
101
|
+
This project uses [Appraisal](https://github.com/thoughtbot/appraisal) to test against multiple
|
102
|
+
versions of Rails.
|
103
|
+
|
104
|
+
On Travis, builds are also run on multiple versions of Ruby, each with multiple versions of Rails.
|
105
|
+
|
106
|
+
When you run `bundle install`, it will use the latest version of Rails.
|
107
|
+
You can then run `bundle exec rake spec` to run the test with that version of Rails.
|
108
|
+
|
109
|
+
To run the specs against each version of Rails, use `bundle exec appraisal rake spec`.
|
data/Rakefile
CHANGED
data/github_webhook.gemspec
CHANGED
@@ -25,5 +25,6 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_development_dependency "bundler", "~> 1.5"
|
26
26
|
spec.add_development_dependency "rake", "~> 10.1"
|
27
27
|
spec.add_development_dependency "rspec", "~> 2.14"
|
28
|
-
spec.add_development_dependency "codeclimate-test-reporter"
|
28
|
+
spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0"
|
29
|
+
spec.add_development_dependency "appraisal"
|
29
30
|
end
|
@@ -13,14 +13,10 @@ module GithubWebhook::Processor
|
|
13
13
|
|
14
14
|
# To fetch list from https://developer.github.com/v3/activity/events/types
|
15
15
|
# run this little JS code in the console:
|
16
|
-
#
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
# }
|
21
|
-
# });
|
22
|
-
# console.log(events);
|
23
|
-
GITHUB_EVENTS_WHITELIST = %w(
|
16
|
+
# $("h3:contains('Webhook event name')").next('p').each((_, p) => console.log(p.innerText))
|
17
|
+
GITHUB_EVENTS = %w(
|
18
|
+
check_run
|
19
|
+
check_suite
|
24
20
|
commit_comment
|
25
21
|
create
|
26
22
|
delete
|
@@ -30,16 +26,14 @@ module GithubWebhook::Processor
|
|
30
26
|
follow
|
31
27
|
fork
|
32
28
|
fork_apply
|
29
|
+
github_app_authorization
|
33
30
|
gist
|
34
31
|
gollum
|
35
32
|
installation
|
36
33
|
installation_repositories
|
37
|
-
integration_installation
|
38
|
-
integration_installation_repositories
|
39
|
-
issues
|
40
34
|
issue_comment
|
35
|
+
issues
|
41
36
|
label
|
42
|
-
marketplace_purchase
|
43
37
|
member
|
44
38
|
membership
|
45
39
|
milestone
|
@@ -47,9 +41,9 @@ module GithubWebhook::Processor
|
|
47
41
|
org_block
|
48
42
|
page_build
|
49
43
|
ping
|
50
|
-
project
|
51
44
|
project_card
|
52
45
|
project_column
|
46
|
+
project
|
53
47
|
public
|
54
48
|
pull_request
|
55
49
|
pull_request_review
|
@@ -57,6 +51,8 @@ module GithubWebhook::Processor
|
|
57
51
|
push
|
58
52
|
release
|
59
53
|
repository
|
54
|
+
repository_import
|
55
|
+
repository_vulnerability_alert
|
60
56
|
status
|
61
57
|
team
|
62
58
|
team_add
|
@@ -94,7 +90,7 @@ module GithubWebhook::Processor
|
|
94
90
|
end
|
95
91
|
|
96
92
|
def check_github_event!
|
97
|
-
unless
|
93
|
+
unless GITHUB_EVENTS.include?(request.headers['X-GitHub-Event'])
|
98
94
|
raise UnsupportedGithubEventError.new("#{request.headers['X-GitHub-Event']} is not a whiltelisted GitHub event. See https://developer.github.com/v3/activity/events/types/")
|
99
95
|
end
|
100
96
|
end
|
@@ -117,7 +113,7 @@ module GithubWebhook::Processor
|
|
117
113
|
payload = request_body
|
118
114
|
else
|
119
115
|
raise UnsupportedContentTypeError.new(
|
120
|
-
"Content-Type #{content_type} is not supported. Use 'application/x-www-form-urlencoded' or 'application
|
116
|
+
"Content-Type #{content_type} is not supported. Use 'application/x-www-form-urlencoded' or 'application/json")
|
121
117
|
end
|
122
118
|
ActiveSupport::HashWithIndifferentAccess.new(JSON.load(payload))
|
123
119
|
)
|
data/spec/spec_helper.rb
CHANGED
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: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastien Saunier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -96,6 +96,20 @@ dependencies:
|
|
96
96
|
version: '2.14'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: codeclimate-test-reporter
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: appraisal
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - ">="
|
@@ -118,11 +132,14 @@ files:
|
|
118
132
|
- ".gitignore"
|
119
133
|
- ".ruby-version"
|
120
134
|
- ".travis.yml"
|
135
|
+
- Appraisals
|
121
136
|
- Gemfile
|
122
|
-
- Gemfile.lock
|
123
137
|
- LICENSE.txt
|
124
138
|
- README.md
|
125
139
|
- Rakefile
|
140
|
+
- gemfiles/rails_4.2.gemfile
|
141
|
+
- gemfiles/rails_5.0.gemfile
|
142
|
+
- gemfiles/rails_5.1.gemfile
|
126
143
|
- github_webhook.gemspec
|
127
144
|
- lib/github_webhook.rb
|
128
145
|
- lib/github_webhook/processor.rb
|
@@ -150,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
167
|
version: '0'
|
151
168
|
requirements: []
|
152
169
|
rubyforge_project:
|
153
|
-
rubygems_version: 2.6
|
170
|
+
rubygems_version: 2.7.6
|
154
171
|
signing_key:
|
155
172
|
specification_version: 4
|
156
173
|
summary: Process GitHub Webhooks in your Rails app (Controller mixin)
|
data/Gemfile.lock
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
github_webhook (1.1.0)
|
5
|
-
activesupport (>= 4)
|
6
|
-
rack (>= 1.3)
|
7
|
-
railties (>= 4)
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: https://rubygems.org/
|
11
|
-
specs:
|
12
|
-
actionpack (5.1.4)
|
13
|
-
actionview (= 5.1.4)
|
14
|
-
activesupport (= 5.1.4)
|
15
|
-
rack (~> 2.0)
|
16
|
-
rack-test (>= 0.6.3)
|
17
|
-
rails-dom-testing (~> 2.0)
|
18
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
19
|
-
actionview (5.1.4)
|
20
|
-
activesupport (= 5.1.4)
|
21
|
-
builder (~> 3.1)
|
22
|
-
erubi (~> 1.4)
|
23
|
-
rails-dom-testing (~> 2.0)
|
24
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
25
|
-
activesupport (5.1.4)
|
26
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
27
|
-
i18n (~> 0.7)
|
28
|
-
minitest (~> 5.1)
|
29
|
-
tzinfo (~> 1.1)
|
30
|
-
builder (3.2.3)
|
31
|
-
codeclimate-test-reporter (0.4.8)
|
32
|
-
simplecov (>= 0.7.1, < 1.0.0)
|
33
|
-
concurrent-ruby (1.0.5)
|
34
|
-
crass (1.0.2)
|
35
|
-
diff-lcs (1.2.5)
|
36
|
-
docile (1.1.5)
|
37
|
-
erubi (1.6.1)
|
38
|
-
i18n (0.8.6)
|
39
|
-
json (1.8.6)
|
40
|
-
loofah (2.1.1)
|
41
|
-
crass (~> 1.0.2)
|
42
|
-
nokogiri (>= 1.5.9)
|
43
|
-
method_source (0.9.0)
|
44
|
-
mini_portile2 (2.3.0)
|
45
|
-
minitest (5.10.3)
|
46
|
-
nokogiri (1.8.1)
|
47
|
-
mini_portile2 (~> 2.3.0)
|
48
|
-
rack (2.0.3)
|
49
|
-
rack-test (0.7.0)
|
50
|
-
rack (>= 1.0, < 3)
|
51
|
-
rails-dom-testing (2.0.3)
|
52
|
-
activesupport (>= 4.2.0)
|
53
|
-
nokogiri (>= 1.6)
|
54
|
-
rails-html-sanitizer (1.0.3)
|
55
|
-
loofah (~> 2.0)
|
56
|
-
railties (5.1.4)
|
57
|
-
actionpack (= 5.1.4)
|
58
|
-
activesupport (= 5.1.4)
|
59
|
-
method_source
|
60
|
-
rake (>= 0.8.7)
|
61
|
-
thor (>= 0.18.1, < 2.0)
|
62
|
-
rake (10.3.1)
|
63
|
-
rspec (2.14.1)
|
64
|
-
rspec-core (~> 2.14.0)
|
65
|
-
rspec-expectations (~> 2.14.0)
|
66
|
-
rspec-mocks (~> 2.14.0)
|
67
|
-
rspec-core (2.14.8)
|
68
|
-
rspec-expectations (2.14.5)
|
69
|
-
diff-lcs (>= 1.1.3, < 2.0)
|
70
|
-
rspec-mocks (2.14.6)
|
71
|
-
simplecov (0.11.2)
|
72
|
-
docile (~> 1.1.0)
|
73
|
-
json (~> 1.8)
|
74
|
-
simplecov-html (~> 0.10.0)
|
75
|
-
simplecov-html (0.10.0)
|
76
|
-
thor (0.20.0)
|
77
|
-
thread_safe (0.3.6)
|
78
|
-
tzinfo (1.2.3)
|
79
|
-
thread_safe (~> 0.1)
|
80
|
-
|
81
|
-
PLATFORMS
|
82
|
-
ruby
|
83
|
-
|
84
|
-
DEPENDENCIES
|
85
|
-
bundler (~> 1.5)
|
86
|
-
codeclimate-test-reporter
|
87
|
-
github_webhook!
|
88
|
-
rake (~> 10.1)
|
89
|
-
rspec (~> 2.14)
|
90
|
-
|
91
|
-
BUNDLED WITH
|
92
|
-
1.16.0.pre.2
|