lita-github-web-hooks-core 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/LICENSE +202 -21
- data/{LICENSE.txt → NOTICE} +16 -3
- data/README.md +3 -1
- data/lib/lita-github-web-hooks-core.rb +13 -0
- data/lib/lita/extensions/github_web_hooks_core.rb +14 -1
- data/lib/lita/extensions/github_web_hooks_core/hook_receiver.rb +13 -0
- data/lib/lita/extensions/github_web_hooks_core/hooks.rb +13 -0
- data/lib/lita/extensions/github_web_hooks_core/hooks/commit_comment.rb +19 -6
- data/lib/lita/extensions/github_web_hooks_core/hooks/create.rb +14 -1
- data/lib/lita/extensions/github_web_hooks_core/hooks/delete.rb +14 -1
- data/lib/lita/extensions/github_web_hooks_core/hooks/deployment.rb +20 -7
- data/lib/lita/extensions/github_web_hooks_core/hooks/deployment_status.rb +22 -9
- data/lib/lita/extensions/github_web_hooks_core/hooks/download.rb +13 -0
- data/lib/lita/extensions/github_web_hooks_core/hooks/follow.rb +13 -0
- data/lib/lita/extensions/github_web_hooks_core/hooks/fork.rb +15 -2
- data/lib/lita/extensions/github_web_hooks_core/hooks/fork_apply.rb +13 -0
- data/lib/lita/extensions/github_web_hooks_core/hooks/gist.rb +13 -0
- data/lib/lita/extensions/github_web_hooks_core/hooks/gollum.rb +13 -0
- data/lib/lita/extensions/github_web_hooks_core/hooks/hook.rb +16 -3
- data/lib/lita/extensions/github_web_hooks_core/hooks/issue_comment.rb +20 -7
- data/lib/lita/extensions/github_web_hooks_core/hooks/issues.rb +13 -0
- data/lib/lita/extensions/github_web_hooks_core/hooks/member.rb +14 -1
- data/lib/lita/extensions/github_web_hooks_core/hooks/membership.rb +13 -0
- data/lib/lita/extensions/github_web_hooks_core/hooks/page_build.rb +13 -0
- data/lib/lita/extensions/github_web_hooks_core/hooks/ping.rb +13 -0
- data/lib/lita/extensions/github_web_hooks_core/hooks/public.rb +14 -1
- data/lib/lita/extensions/github_web_hooks_core/hooks/pull_request.rb +30 -17
- data/lib/lita/extensions/github_web_hooks_core/hooks/pull_request_review_comment.rb +24 -11
- data/lib/lita/extensions/github_web_hooks_core/hooks/push.rb +18 -5
- data/lib/lita/extensions/github_web_hooks_core/hooks/release.rb +14 -1
- data/lib/lita/extensions/github_web_hooks_core/hooks/repo_hooks.rb +18 -5
- data/lib/lita/extensions/github_web_hooks_core/hooks/repository.rb +13 -0
- data/lib/lita/extensions/github_web_hooks_core/hooks/status.rb +17 -4
- data/lib/lita/extensions/github_web_hooks_core/hooks/team_add.rb +13 -0
- data/lib/lita/extensions/github_web_hooks_core/hooks/watch.rb +16 -3
- data/lib/lita/github/web/hooks/core.rb +13 -0
- data/lib/lita/github/web/hooks/core/version.rb +14 -1
- data/lita-github-web-hooks-core.gemspec +1 -1
- metadata +3 -4
- data/lib/lita/extensions/github_web_hooks_core/listeners.rb +0 -22
@@ -1,3 +1,16 @@
|
|
1
|
+
# Copyright 2015 Levvel, LLC
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
3
|
+
# you may not use this file except in compliance with the License.
|
4
|
+
# You may obtain a copy of the License at
|
5
|
+
#
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
#
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
# See the License for the specific language governing permissions and
|
12
|
+
# limitations under the License.
|
13
|
+
|
1
14
|
module Lita::Extensions
|
2
15
|
module GitHubWebHooksCore
|
3
16
|
module Hooks
|
@@ -6,59 +19,59 @@ module Lita::Extensions
|
|
6
19
|
def requester
|
7
20
|
payload["sender"]
|
8
21
|
end
|
9
|
-
|
22
|
+
|
10
23
|
def pr
|
11
24
|
payload["pull_request"]
|
12
25
|
end
|
13
|
-
|
26
|
+
|
14
27
|
def title
|
15
28
|
pr["title"]
|
16
29
|
end
|
17
|
-
|
30
|
+
|
18
31
|
def number
|
19
32
|
pr["number"]
|
20
33
|
end
|
21
|
-
|
34
|
+
|
22
35
|
def target_branch
|
23
36
|
pr["base"]["label"].split(":").last
|
24
37
|
end
|
25
|
-
|
38
|
+
|
26
39
|
def candidate_branch
|
27
40
|
pr["head"]["label"].split(":").last
|
28
41
|
end
|
29
|
-
|
42
|
+
|
30
43
|
def url
|
31
44
|
pr["html_url"]
|
32
45
|
end
|
33
|
-
|
46
|
+
|
34
47
|
def ref
|
35
48
|
pr["head"]["ref"]
|
36
49
|
end
|
37
|
-
|
50
|
+
|
38
51
|
def sha
|
39
52
|
pr["head"]["sha"]
|
40
53
|
end
|
41
|
-
|
54
|
+
|
42
55
|
def action
|
43
56
|
payload["action"]
|
44
57
|
end
|
45
|
-
|
58
|
+
|
46
59
|
def opened?
|
47
60
|
action == "opened"
|
48
61
|
end
|
49
|
-
|
62
|
+
|
50
63
|
def synchronized?
|
51
|
-
action == "synchronize"
|
64
|
+
action == "synchronize"
|
52
65
|
end
|
53
|
-
|
66
|
+
|
54
67
|
def closed?
|
55
68
|
action == "closed"
|
56
69
|
end
|
57
|
-
|
70
|
+
|
58
71
|
def merged?
|
59
72
|
closed? && pr["merged"]
|
60
73
|
end
|
61
|
-
|
74
|
+
|
62
75
|
def attributes
|
63
76
|
{requester: requester,
|
64
77
|
pr: pr,
|
@@ -67,13 +80,13 @@ module Lita::Extensions
|
|
67
80
|
url: url
|
68
81
|
}
|
69
82
|
end
|
70
|
-
|
83
|
+
|
71
84
|
def set_status(status, options={})
|
72
85
|
return if status.nil? || options[:target_url].nil?
|
73
86
|
options[:context] ||= "lita"
|
74
87
|
client.create_status(self.repo, self.sha, status, options)
|
75
88
|
end
|
76
|
-
|
89
|
+
|
77
90
|
def to_s
|
78
91
|
if merged?
|
79
92
|
"[#{self.repo}] #{self.requester["login"]} has merged #{candidate_branch} to #{target_branch} and #{self.action} pull request ##{self.number}: #{self.title}"
|
@@ -1,3 +1,16 @@
|
|
1
|
+
# Copyright 2015 Levvel, LLC
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
3
|
+
# you may not use this file except in compliance with the License.
|
4
|
+
# You may obtain a copy of the License at
|
5
|
+
#
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
#
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
# See the License for the specific language governing permissions and
|
12
|
+
# limitations under the License.
|
13
|
+
|
1
14
|
module Lita::Extensions
|
2
15
|
module GitHubWebHooksCore
|
3
16
|
module Hooks
|
@@ -6,47 +19,47 @@ module Lita::Extensions
|
|
6
19
|
def requester
|
7
20
|
payload["sender"]
|
8
21
|
end
|
9
|
-
|
22
|
+
|
10
23
|
def pr
|
11
24
|
payload["pull_request"]
|
12
25
|
end
|
13
|
-
|
26
|
+
|
14
27
|
def target_branch
|
15
28
|
pr["base"]["label"]
|
16
29
|
end
|
17
|
-
|
30
|
+
|
18
31
|
def candidate_branch
|
19
32
|
pr["head"]["label"]
|
20
33
|
end
|
21
|
-
|
34
|
+
|
22
35
|
def url
|
23
36
|
pr["html_url"]
|
24
37
|
end
|
25
|
-
|
38
|
+
|
26
39
|
def body
|
27
40
|
comment["body"]
|
28
41
|
end
|
29
|
-
|
42
|
+
|
30
43
|
def comment
|
31
44
|
payload["comment"]
|
32
45
|
end
|
33
|
-
|
46
|
+
|
34
47
|
def commenter
|
35
48
|
payload["sender"]["login"]
|
36
49
|
end
|
37
|
-
|
50
|
+
|
38
51
|
def path
|
39
52
|
comment["path"]
|
40
53
|
end
|
41
|
-
|
54
|
+
|
42
55
|
def number
|
43
56
|
pr["number"]
|
44
57
|
end
|
45
|
-
|
58
|
+
|
46
59
|
def ref
|
47
60
|
pr["ref"]
|
48
61
|
end
|
49
|
-
|
62
|
+
|
50
63
|
def attributes
|
51
64
|
{
|
52
65
|
requester: requester,
|
@@ -1,21 +1,34 @@
|
|
1
|
+
# Copyright 2015 Levvel, LLC
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
3
|
+
# you may not use this file except in compliance with the License.
|
4
|
+
# You may obtain a copy of the License at
|
5
|
+
#
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
#
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
# See the License for the specific language governing permissions and
|
12
|
+
# limitations under the License.
|
13
|
+
|
1
14
|
module Lita::Extensions
|
2
15
|
module GitHubWebHooksCore
|
3
16
|
module Hooks
|
4
17
|
class Push < Hook
|
5
|
-
|
18
|
+
|
6
19
|
include Lita::Extensions::GitHubWebHooksCore::Hooks::RepoHooks
|
7
20
|
def committer
|
8
21
|
sender["login"]
|
9
22
|
end
|
10
|
-
|
23
|
+
|
11
24
|
def commit_count
|
12
25
|
payload["commits"].length.to_s
|
13
26
|
end
|
14
|
-
|
27
|
+
|
15
28
|
def sender
|
16
29
|
payload["sender"]
|
17
30
|
end
|
18
|
-
|
31
|
+
|
19
32
|
def attributes
|
20
33
|
{
|
21
34
|
committer: committer,
|
@@ -24,7 +37,7 @@ module Lita::Extensions
|
|
24
37
|
sender: sender
|
25
38
|
}
|
26
39
|
end
|
27
|
-
|
40
|
+
|
28
41
|
private
|
29
42
|
|
30
43
|
def message
|
@@ -1,3 +1,16 @@
|
|
1
|
+
# Copyright 2015 Levvel, LLC
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
3
|
+
# you may not use this file except in compliance with the License.
|
4
|
+
# You may obtain a copy of the License at
|
5
|
+
#
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
#
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
# See the License for the specific language governing permissions and
|
12
|
+
# limitations under the License.
|
13
|
+
|
1
14
|
module Lita::Extensions
|
2
15
|
module GitHubWebHooksCore
|
3
16
|
module Hooks
|
@@ -10,7 +23,7 @@ module Lita::Extensions
|
|
10
23
|
payload["release"]["tag_name"]
|
11
24
|
end
|
12
25
|
def url
|
13
|
-
payload["release"]["html_url"]
|
26
|
+
payload["release"]["html_url"]
|
14
27
|
end
|
15
28
|
def attributes
|
16
29
|
{
|
@@ -1,17 +1,30 @@
|
|
1
|
+
# Copyright 2015 Levvel, LLC
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
3
|
+
# you may not use this file except in compliance with the License.
|
4
|
+
# You may obtain a copy of the License at
|
5
|
+
#
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
#
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
# See the License for the specific language governing permissions and
|
12
|
+
# limitations under the License.
|
13
|
+
|
1
14
|
module Lita::Extensions
|
2
15
|
module GitHubWebHooksCore::Hooks::RepoHooks
|
3
16
|
def repository
|
4
17
|
payload["repository"]
|
5
18
|
end
|
6
|
-
|
19
|
+
|
7
20
|
def repo
|
8
21
|
repository["full_name"]
|
9
22
|
end
|
10
|
-
|
23
|
+
|
11
24
|
def client
|
12
|
-
client = Octokit::Client.new(access_token: access_token)
|
25
|
+
client = Octokit::Client.new(access_token: access_token)
|
13
26
|
end
|
14
|
-
|
27
|
+
|
15
28
|
def access_token
|
16
29
|
t = ENV["GITHUB_ACCESS_TOKEN"]
|
17
30
|
if t.nil?
|
@@ -19,6 +32,6 @@ module Lita::Extensions
|
|
19
32
|
end
|
20
33
|
t
|
21
34
|
end
|
22
|
-
|
35
|
+
|
23
36
|
end
|
24
37
|
end
|
@@ -1,3 +1,16 @@
|
|
1
|
+
# Copyright 2015 Levvel, LLC
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
3
|
+
# you may not use this file except in compliance with the License.
|
4
|
+
# You may obtain a copy of the License at
|
5
|
+
#
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
#
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
# See the License for the specific language governing permissions and
|
12
|
+
# limitations under the License.
|
13
|
+
|
1
14
|
module Lita::Extensions
|
2
15
|
module GitHubWebHooksCore
|
3
16
|
module Hooks
|
@@ -1,3 +1,16 @@
|
|
1
|
+
# Copyright 2015 Levvel, LLC
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
3
|
+
# you may not use this file except in compliance with the License.
|
4
|
+
# You may obtain a copy of the License at
|
5
|
+
#
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
#
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
# See the License for the specific language governing permissions and
|
12
|
+
# limitations under the License.
|
13
|
+
|
1
14
|
module Lita::Extensions
|
2
15
|
module GitHubWebHooksCore
|
3
16
|
module Hooks
|
@@ -6,19 +19,19 @@ module Lita::Extensions
|
|
6
19
|
def sha
|
7
20
|
payload["sha"]
|
8
21
|
end
|
9
|
-
|
22
|
+
|
10
23
|
def status
|
11
24
|
payload["state"]
|
12
25
|
end
|
13
|
-
|
26
|
+
|
14
27
|
def context
|
15
28
|
payload["context"]
|
16
29
|
end
|
17
|
-
|
30
|
+
|
18
31
|
def description
|
19
32
|
payload["description"]
|
20
33
|
end
|
21
|
-
|
34
|
+
|
22
35
|
def attributes
|
23
36
|
{
|
24
37
|
sha: sha,
|
@@ -1,3 +1,16 @@
|
|
1
|
+
# Copyright 2015 Levvel, LLC
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
3
|
+
# you may not use this file except in compliance with the License.
|
4
|
+
# You may obtain a copy of the License at
|
5
|
+
#
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
#
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
# See the License for the specific language governing permissions and
|
12
|
+
# limitations under the License.
|
13
|
+
|
1
14
|
module Lita::Extensions
|
2
15
|
module GitHubWebHooksCore
|
3
16
|
module Hooks
|
@@ -1,14 +1,27 @@
|
|
1
|
+
# Copyright 2015 Levvel, LLC
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
3
|
+
# you may not use this file except in compliance with the License.
|
4
|
+
# You may obtain a copy of the License at
|
5
|
+
#
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
#
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
# See the License for the specific language governing permissions and
|
12
|
+
# limitations under the License.
|
13
|
+
|
1
14
|
module Lita::Extensions
|
2
15
|
module GitHubWebHooksCore
|
3
16
|
module Hooks
|
4
17
|
class Watch < Hook
|
5
|
-
|
6
|
-
include Lita::Extensions::GitHubWebHooksCore::Hooks::RepoHooks
|
18
|
+
|
19
|
+
include Lita::Extensions::GitHubWebHooksCore::Hooks::RepoHooks
|
7
20
|
|
8
21
|
def user
|
9
22
|
payload["sender"]["login"]
|
10
23
|
end
|
11
|
-
|
24
|
+
|
12
25
|
def attributes
|
13
26
|
{
|
14
27
|
user: user,
|
@@ -1,3 +1,16 @@
|
|
1
|
+
# Copyright 2015 Levvel, LLC
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
3
|
+
# you may not use this file except in compliance with the License.
|
4
|
+
# You may obtain a copy of the License at
|
5
|
+
#
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
#
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
# See the License for the specific language governing permissions and
|
12
|
+
# limitations under the License.
|
13
|
+
|
1
14
|
require "lita/github/web/hooks/core/version"
|
2
15
|
|
3
16
|
module Lita
|
@@ -1,8 +1,21 @@
|
|
1
|
+
# Copyright 2015 Levvel, LLC
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
3
|
+
# you may not use this file except in compliance with the License.
|
4
|
+
# You may obtain a copy of the License at
|
5
|
+
#
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
#
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
# See the License for the specific language governing permissions and
|
12
|
+
# limitations under the License.
|
13
|
+
|
1
14
|
module Lita
|
2
15
|
module Github
|
3
16
|
module WebHooks
|
4
17
|
module Core
|
5
|
-
VERSION = "1.0.
|
18
|
+
VERSION = "1.0.1"
|
6
19
|
end
|
7
20
|
end
|
8
21
|
end
|