ellen-github 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +2 -2
- data/images/screenshot.png +0 -0
- data/lib/ellen/github/actions/base.rb +0 -2
- data/lib/ellen/github/actions/create_issue.rb +0 -2
- data/lib/ellen/github/actions/create_pull_request.rb +74 -0
- data/lib/ellen/github/actions/merge_pull_request.rb +18 -0
- data/lib/ellen/github/version.rb +1 -1
- data/lib/ellen/github.rb +2 -0
- data/lib/ellen/handlers/github.rb +20 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: acc3355f699b0715fe2bbd77cb56120ca7b30dfb
|
4
|
+
data.tar.gz: 2d12f467990c9540efd11f3b7bf319023dd456cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b05fcd753f224264804dcf5bf45e883ad344980a2986f4bbd84996f220a2281ddd88fa20e542234c478714ea2b71b33935a3dd18edf70b3287d992267e0eaf7f
|
7
|
+
data.tar.gz: c30249315c4064329e08216f053d96903b06e227dfd5d03a272570e7cedd9e37e3a7936d11b9577d54be4c86011c5201add2c79257611f36dabdecda196ab439
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -9,8 +9,8 @@ gem "ellen-github"
|
|
9
9
|
|
10
10
|
## Usage
|
11
11
|
```
|
12
|
-
@ellen close issue <
|
13
|
-
@ellen create issue "<title>" on <
|
12
|
+
@ellen close issue <repo>#<number> - Close an Issue
|
13
|
+
@ellen create issue "<title>" on <repo>[\n<description>] - Create a new Issue
|
14
14
|
@ellen remember my github token <token> - Remember sender's GitHub access token
|
15
15
|
```
|
16
16
|
|
data/images/screenshot.png
CHANGED
Binary file
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module Ellen
|
2
|
+
module Github
|
3
|
+
module Actions
|
4
|
+
class CreatePullRequest < Base
|
5
|
+
def call
|
6
|
+
if has_access_token?
|
7
|
+
create
|
8
|
+
else
|
9
|
+
require_access_token
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def create
|
16
|
+
message.reply("Created #{pull_request.html_url}")
|
17
|
+
rescue Octokit::Unauthorized
|
18
|
+
message.reply("Failed in authentication (401)")
|
19
|
+
rescue Octokit::NotFound
|
20
|
+
message.reply("Could not find that repository")
|
21
|
+
rescue => exception
|
22
|
+
message.reply("Failed by #{exception.class} #{exception}")
|
23
|
+
end
|
24
|
+
|
25
|
+
def pull_request
|
26
|
+
client.create_pull_request(repository, base, head, title, description)
|
27
|
+
end
|
28
|
+
|
29
|
+
def title
|
30
|
+
message[:title]
|
31
|
+
end
|
32
|
+
|
33
|
+
def description
|
34
|
+
message[:description]
|
35
|
+
end
|
36
|
+
|
37
|
+
# e.g. alice/foo:test
|
38
|
+
def from
|
39
|
+
message[:from]
|
40
|
+
end
|
41
|
+
|
42
|
+
# e.g. alice
|
43
|
+
def from_user
|
44
|
+
from.split("/").first
|
45
|
+
end
|
46
|
+
|
47
|
+
# e.g. test
|
48
|
+
def from_branch
|
49
|
+
from.split(":").last
|
50
|
+
end
|
51
|
+
|
52
|
+
# e.g. bob/foo:master
|
53
|
+
def to
|
54
|
+
message[:to]
|
55
|
+
end
|
56
|
+
|
57
|
+
# e.g. bob/foo
|
58
|
+
def repository
|
59
|
+
to.split(":").first
|
60
|
+
end
|
61
|
+
|
62
|
+
# e.g. alice:test
|
63
|
+
def head
|
64
|
+
"#{from_user}:#{from_branch}"
|
65
|
+
end
|
66
|
+
|
67
|
+
# e.g. master
|
68
|
+
def base
|
69
|
+
to.split(":").last
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Ellen
|
2
|
+
module Github
|
3
|
+
module Actions
|
4
|
+
class MergePullRequest < CloseIssue
|
5
|
+
private
|
6
|
+
|
7
|
+
def close
|
8
|
+
request
|
9
|
+
message.reply("Merged #{issue.html_url}")
|
10
|
+
end
|
11
|
+
|
12
|
+
def request
|
13
|
+
client.merge_pull_request(repository, issue_number)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/ellen/github/version.rb
CHANGED
data/lib/ellen/github.rb
CHANGED
@@ -5,6 +5,8 @@ require "ellen"
|
|
5
5
|
require "ellen/github/actions/base"
|
6
6
|
require "ellen/github/actions/close_issue"
|
7
7
|
require "ellen/github/actions/create_issue"
|
8
|
+
require "ellen/github/actions/create_pull_request"
|
9
|
+
require "ellen/github/actions/merge_pull_request"
|
8
10
|
require "ellen/github/actions/remember"
|
9
11
|
require "ellen/github/version"
|
10
12
|
require "ellen/handlers/github"
|
@@ -19,6 +19,18 @@ module Ellen
|
|
19
19
|
description: "Close an issue",
|
20
20
|
)
|
21
21
|
|
22
|
+
on(
|
23
|
+
/pull request "(?<title>.+)" from (?<from>.+) to (?<to>.+)(?:\n(?<description>[\s\S]+))?\z/,
|
24
|
+
name: "create_pull_request",
|
25
|
+
description: "Create a pull request",
|
26
|
+
)
|
27
|
+
|
28
|
+
on(
|
29
|
+
/merge pull request (?<repo>.+)#(?<number>\d+)\z/,
|
30
|
+
name: "merge_pull_request",
|
31
|
+
description: "Merge pull request",
|
32
|
+
)
|
33
|
+
|
22
34
|
def create_issue(message)
|
23
35
|
Ellen::Github::Actions::CreateIssue.new(message).call
|
24
36
|
end
|
@@ -30,6 +42,14 @@ module Ellen
|
|
30
42
|
def remember(message)
|
31
43
|
Ellen::Github::Actions::Remember.new(message).call
|
32
44
|
end
|
45
|
+
|
46
|
+
def create_pull_request(message)
|
47
|
+
Ellen::Github::Actions::CreatePullRequest.new(message).call
|
48
|
+
end
|
49
|
+
|
50
|
+
def merge_pull_request(message)
|
51
|
+
Ellen::Github::Actions::MergePullRequest.new(message).call
|
52
|
+
end
|
33
53
|
end
|
34
54
|
end
|
35
55
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ellen-github
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
@@ -141,6 +141,8 @@ files:
|
|
141
141
|
- lib/ellen/github/actions/base.rb
|
142
142
|
- lib/ellen/github/actions/close_issue.rb
|
143
143
|
- lib/ellen/github/actions/create_issue.rb
|
144
|
+
- lib/ellen/github/actions/create_pull_request.rb
|
145
|
+
- lib/ellen/github/actions/merge_pull_request.rb
|
144
146
|
- lib/ellen/github/actions/remember.rb
|
145
147
|
- lib/ellen/github/version.rb
|
146
148
|
- lib/ellen/handlers/github.rb
|