rondabot 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +28 -8
- data/lib/module/Azure.rb +18 -5
- data/lib/module/Core.rb +1 -2
- data/lib/module/GitHub.rb +14 -4
- data/lib/module/GitLab.rb +0 -3
- data/lib/module/SourceControl.rb +11 -22
- data/lib/rondabot.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 950eb5a191650e0e0b1935b34bdf5eb251d908df604b8225f6c8c2cd06e264f7
|
|
4
|
+
data.tar.gz: 9f36e7afbc04fe8a3ecf64a4f4671b4fdb0eadceffb2848fed1c2a62b609cd3f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0a32928624a26886eab26cb81c64ee2a7a29b759a486ff92047e424e36fc997d2355ddc38fc90a7ccdc74bdcd8e056c17fd51416a769e296d01b30e8a2358010
|
|
7
|
+
data.tar.gz: d0cfc6c44c3ec5b06880e65fda10a37389649239806a3ce03dd1dba5a0801e057fff9d97ff5d4d6b91d64237559eee041e0c5bb7a9a3bbd8e9a2a0c7d0130da1
|
data/README.md
CHANGED
|
@@ -53,11 +53,13 @@ core.start()
|
|
|
53
53
|
| **organization** | Name of your organization on azure devops |
|
|
54
54
|
| **project** | Name of your project on azure devops |
|
|
55
55
|
| **repository** | Name of your project to using for clone and create pull requests |
|
|
56
|
-
| **
|
|
56
|
+
| **access_token** | A git credentials to clone e create pull requests |
|
|
57
57
|
| **feed_id** | Your feed id npm/yarn on azure devops. Go to Azure Devops, your project _Artifacts_ > _Connect to feed_ > _npm_ and then you can find feed id in the url looks like `https://pkgs.dev.azure.com/your organization name/you feed id to be right here/_packaging/npm-packages/npm/registry/` |
|
|
58
|
-
| **
|
|
58
|
+
| **github_token** | Allows passing in a GitHub access token so that the API rate limiting is not exceeded. When the repository's visibility is public, the `github_token` must be an access token with read access to the public repositories. When repository visibility is private, the `github_token` must be an access token with full control of private repositories. |
|
|
59
59
|
|
|
60
|
-
##
|
|
60
|
+
## Examples
|
|
61
|
+
|
|
62
|
+
### Azure Devops
|
|
61
63
|
|
|
62
64
|
```ruby
|
|
63
65
|
require "dependabot/omnibus"
|
|
@@ -68,12 +70,30 @@ core = Rondabot::Core.new(
|
|
|
68
70
|
organization: "Akatsuki",
|
|
69
71
|
project: "Digital%20Channel",
|
|
70
72
|
repository: "akatsuki-website",
|
|
71
|
-
|
|
72
|
-
:username => "Ronda.Bot",
|
|
73
|
-
:password => "cm9uZGluZWxsaW1vcmFpcwcm9uZGFib3Q"
|
|
74
|
-
},
|
|
73
|
+
access_token: "cm9uZGluZWxsaW1vcmFpcwcm9uZGFib3Q"
|
|
75
74
|
feed_id: "11db190-e3b1872-1e6e6e-c97f2dd-49253",
|
|
76
|
-
|
|
75
|
+
github_token: "11db190e3b18721e6e6ec97f2dd49253"
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
core.start()
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### GitHub
|
|
82
|
+
|
|
83
|
+
> **WARNING**
|
|
84
|
+
>
|
|
85
|
+
> When the repository's visibility is public, the `github_token` must be an access token with read access to the public repositories.
|
|
86
|
+
>
|
|
87
|
+
> When repository visibility is private, the `github_token` must be an access token with full control of private repositories.
|
|
88
|
+
|
|
89
|
+
```ruby
|
|
90
|
+
require "dependabot/omnibus"
|
|
91
|
+
require "rondabot"
|
|
92
|
+
|
|
93
|
+
core = Rondabot::Core.new(
|
|
94
|
+
provider: "github",
|
|
95
|
+
repository: "rondinellimorais/rondabot",
|
|
96
|
+
github_token: "11db190e3b18721e6e6ec97f2dd49253"
|
|
77
97
|
)
|
|
78
98
|
|
|
79
99
|
core.start()
|
data/lib/module/Azure.rb
CHANGED
|
@@ -2,15 +2,17 @@ module Rondabot
|
|
|
2
2
|
class Azure < SourceControl
|
|
3
3
|
def initialize params
|
|
4
4
|
super(params)
|
|
5
|
-
@repository = params[:repository]
|
|
6
5
|
@project = params[:project]
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
if params[:access_token].nil?
|
|
8
|
+
raise ArgumentError.new("'access_token' param is missing!")
|
|
9
|
+
end
|
|
10
|
+
|
|
9
11
|
@credentials << {
|
|
10
12
|
"type" => "git_source",
|
|
11
13
|
"host" => "dev.azure.com",
|
|
12
|
-
"username" =>
|
|
13
|
-
"password" =>
|
|
14
|
+
"username" => "x-access-token",
|
|
15
|
+
"password" => params[:access_token]
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
# get organization
|
|
@@ -28,7 +30,7 @@ module Rondabot
|
|
|
28
30
|
@credentials << {
|
|
29
31
|
"type" => "npm_registry",
|
|
30
32
|
"registry" => "https://pkgs.dev.azure.com/#{@organization}/#{@feed_id}/_packaging/npm-packages/npm/registry/",
|
|
31
|
-
"token" => "#{@feed_id}:#{
|
|
33
|
+
"token" => "#{@feed_id}:#{params[:access_token]}"
|
|
32
34
|
}
|
|
33
35
|
end
|
|
34
36
|
|
|
@@ -43,5 +45,16 @@ module Rondabot
|
|
|
43
45
|
|
|
44
46
|
return "#{@organization}/#{@project}/_git/#{@repository}"
|
|
45
47
|
end
|
|
48
|
+
|
|
49
|
+
def create_pull_request params
|
|
50
|
+
pull_request = super(params)
|
|
51
|
+
|
|
52
|
+
if pull_request&.status == 201
|
|
53
|
+
content = JSON[pull_request.body]
|
|
54
|
+
puts " PR ##{content["pullRequestId"]} submitted"
|
|
55
|
+
else
|
|
56
|
+
puts " PR already exists or an error has occurred"
|
|
57
|
+
end
|
|
58
|
+
end
|
|
46
59
|
end
|
|
47
60
|
end
|
data/lib/module/Core.rb
CHANGED
|
@@ -13,8 +13,7 @@ module Rondabot
|
|
|
13
13
|
# @source_control = Rondabot::GitLab.new(params)
|
|
14
14
|
raise ArgumentError.new("gitlab available soon :)")
|
|
15
15
|
when 'github'
|
|
16
|
-
|
|
17
|
-
raise ArgumentError.new("github available soon :)")
|
|
16
|
+
@source_control = Rondabot::GitHub.new(params)
|
|
18
17
|
else
|
|
19
18
|
raise ArgumentError.new("'provider' param is missing! The available values are: azure, gitlab or github.")
|
|
20
19
|
end
|
data/lib/module/GitHub.rb
CHANGED
|
@@ -2,13 +2,23 @@ module Rondabot
|
|
|
2
2
|
class GitHub < SourceControl
|
|
3
3
|
def initialize params
|
|
4
4
|
super(params)
|
|
5
|
-
|
|
6
|
-
# get the user credentials
|
|
7
|
-
# user_credentials = get_user_credentials(params)
|
|
8
5
|
end
|
|
9
6
|
|
|
10
7
|
def repository_uri
|
|
11
|
-
|
|
8
|
+
if @repository.nil?
|
|
9
|
+
raise ArgumentError.new("'repository' param is missing!")
|
|
10
|
+
end
|
|
11
|
+
return @repository
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def create_pull_request params
|
|
15
|
+
pull_request = super(params)
|
|
16
|
+
|
|
17
|
+
if pull_request.state == 'open'
|
|
18
|
+
puts " PR ##{pull_request.number} submitted"
|
|
19
|
+
else
|
|
20
|
+
puts " PR already exists or an error has occurred"
|
|
21
|
+
end
|
|
12
22
|
end
|
|
13
23
|
end
|
|
14
24
|
end
|
data/lib/module/GitLab.rb
CHANGED
data/lib/module/SourceControl.rb
CHANGED
|
@@ -7,17 +7,22 @@ module Rondabot
|
|
|
7
7
|
def initialize params
|
|
8
8
|
@credentials = []
|
|
9
9
|
@provider = params[:provider]
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
@repository = params[:repository]
|
|
11
|
+
|
|
12
|
+
# When the repository's visibility is public,
|
|
13
|
+
# the `github_token` must be an access token with read access to the public repositories.
|
|
14
|
+
#
|
|
15
|
+
# When repository visibility is private,
|
|
16
|
+
# the `github_token` must be an access token with full control of private repositories.
|
|
17
|
+
if params[:github_token].nil?
|
|
18
|
+
raise ArgumentError.new("'github_token' param is missing!")
|
|
14
19
|
end
|
|
15
20
|
|
|
16
21
|
@credentials << {
|
|
17
22
|
"type" => "git_source",
|
|
18
23
|
"host" => "github.com",
|
|
19
24
|
"username" => "x-access-token",
|
|
20
|
-
"password" => "#{params[:
|
|
25
|
+
"password" => "#{params[:github_token]}"
|
|
21
26
|
}
|
|
22
27
|
end
|
|
23
28
|
|
|
@@ -43,23 +48,7 @@ module Rondabot
|
|
|
43
48
|
label_language: true
|
|
44
49
|
)
|
|
45
50
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if pull_request&.status == 201
|
|
49
|
-
content = JSON[pull_request.body]
|
|
50
|
-
puts " PR ##{content["pullRequestId"]} submitted"
|
|
51
|
-
else
|
|
52
|
-
puts " PR already exists or an error has occurred"
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
private
|
|
57
|
-
def get_user_credentials(params)
|
|
58
|
-
_credentials = params[:credentials]
|
|
59
|
-
if _credentials.nil? || _credentials[:username].nil? || _credentials[:password].nil?
|
|
60
|
-
raise ArgumentError.new("'credentials' param is missing! Check your credentials parameter")
|
|
61
|
-
end
|
|
62
|
-
return _credentials
|
|
51
|
+
return pr_creator.create
|
|
63
52
|
end
|
|
64
53
|
end
|
|
65
54
|
end
|
data/lib/rondabot.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rondabot
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rondinelli Morais
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-08-
|
|
11
|
+
date: 2020-08-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|