export-pull-requests 0.2.0 → 0.2.1
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/Changes +6 -0
- data/README.md +11 -6
- data/bin/epr +20 -10
- 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: 929623e66a1f68647fabb6f245e3ca7215cd167c
|
4
|
+
data.tar.gz: 6caa7e29e8fc21d83ef30b668f249a44e76529d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1db30f68f7b7dc619d7db177c322976cb8276cb47c9efa50315eb4c8ab2198bf9386f8c433591958d08f8530503a09fe54915c342b7591e01331fec6a37aacb5
|
7
|
+
data.tar.gz: 2e0d613b81ca451402f4e772faff8872de6c4ab9dead6e2cc4d9e88d4ca0b2bae2c1b676420e4bf9091dd664c5ce821c0f99dfeca6f647b499a853a0822e5652
|
data/Changes
CHANGED
data/README.md
CHANGED
@@ -16,14 +16,15 @@ This installs the `epr` executable.
|
|
16
16
|
|
17
17
|
## Usage
|
18
18
|
|
19
|
-
usage: epr [-hv] [-s state] [-t token] [-c user1,user2...] user/repo1 [user/repo2...]
|
19
|
+
usage: epr [-hv] [-e url] [-s state] [-t token] [-c user1,user2...] user/repo1 [user/repo2...]
|
20
20
|
-c, --creator=USER1,USER2,... Export PRs created by given username(s); prepend `!' to exclude user
|
21
|
+
-e, --endpoint=URL Endpoint URL for 'enterprise', etc... repositories
|
21
22
|
-h, --help Show this message
|
22
23
|
-p, --provider=NAME Service provider: bitbucket, github, or gitlab; defaults to github
|
24
|
+
-s, --state=STATE Export items in the given state, defaults to open
|
23
25
|
-t, --token=TOKEN API token
|
24
|
-
-
|
26
|
+
-x, --export=WHAT What to export: pr, issues, or all; defaults to all
|
25
27
|
-v, --version epr version
|
26
|
-
-x, --export=TYPE What to export: pr, issues, or all; defaults to all
|
27
28
|
|
28
29
|
### Config
|
29
30
|
|
@@ -34,7 +35,7 @@ These can all be set by one of the below methods or [via the command line](#usag
|
|
34
35
|
The API token can be set by:
|
35
36
|
|
36
37
|
* `EPR_TOKEN` environment variable
|
37
|
-
* `epr.token` setting in `.gitconfig`
|
38
|
+
* `epr.token` setting in `.gitconfig` (add via `git config --add epr.token <your API token>`)
|
38
39
|
* `github.oauth-token` setting in `.gitconfig`
|
39
40
|
|
40
41
|
#### Default Service
|
@@ -61,6 +62,8 @@ Export all issues from a GitLab project:
|
|
61
62
|
|
62
63
|
## Service Notes
|
63
64
|
|
65
|
+
To connect to a custom/"Enterprise" installation of any of the supported services use the endpoint option (`-e`)
|
66
|
+
|
64
67
|
### Bitbucket
|
65
68
|
|
66
69
|
You can use [app passwords](https://confluence.atlassian.com/bitbucket/app-passwords-828781300.html) for the API token.
|
@@ -70,8 +73,6 @@ Just provide your token HTTP Auth style using: `username:app_password`.
|
|
70
73
|
|
71
74
|
Authentication can be done via a [personal access token](https://gitlab.com/profile/personal_access_tokens).
|
72
75
|
|
73
|
-
Currently the API endpoint URL is hardcoded to `https://gitlab.com/api/v4`.
|
74
|
-
|
75
76
|
Enterprise editions of GitLab have an [issue export feature](https://docs.gitlab.com/ee/user/project/issues/csv_export.html).
|
76
77
|
|
77
78
|
## Author
|
@@ -81,3 +82,7 @@ Skye Shaw [skye.shaw AT gmail]
|
|
81
82
|
## License
|
82
83
|
|
83
84
|
Released under the MIT License: www.opensource.org/licenses/MIT
|
85
|
+
|
86
|
+
---
|
87
|
+
|
88
|
+
Made by [ScreenStaring](http://screenstaring.com)
|
data/bin/epr
CHANGED
@@ -9,7 +9,7 @@ require "github_api"
|
|
9
9
|
require "gitlab"
|
10
10
|
require "bitbucket_rest_api"
|
11
11
|
|
12
|
-
VERSION = "0.2.
|
12
|
+
VERSION = "0.2.1"
|
13
13
|
SERVICES = %w[github gitlab bitbucket]
|
14
14
|
GIT_CONFIGS = %w[epr.token github.oauth-token]
|
15
15
|
|
@@ -51,7 +51,10 @@ def bitbucket(user, repo)
|
|
51
51
|
# TODO: make sure no need to translate any states
|
52
52
|
# https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/pullrequests
|
53
53
|
|
54
|
-
|
54
|
+
options = { :basic_auth => $token }
|
55
|
+
options[:endpoint] = $endpoint if $endpoint
|
56
|
+
|
57
|
+
$bitbucket ||= BitBucket.new(options)
|
55
58
|
|
56
59
|
rows = []
|
57
60
|
no_user = "Anonymous"
|
@@ -129,7 +132,10 @@ def github(user, repo)
|
|
129
132
|
rows = []
|
130
133
|
method = $export == EXPORT_PRS ? :pull_requests : :issues
|
131
134
|
|
132
|
-
|
135
|
+
options = { :oauth_token => $token, :auto_pagination => true }
|
136
|
+
options[:endpoint] = $endpoint if $endpoint
|
137
|
+
|
138
|
+
$gh ||= Github.new(options)
|
133
139
|
$gh.public_send(method).list(:user => user, :repo => repo, :state => $filter).each_page do |page|
|
134
140
|
next if page.size.zero? # Needed for auto_pagination
|
135
141
|
|
@@ -170,8 +176,7 @@ def gitlab(user, repo)
|
|
170
176
|
# Do we care about this differing in output?
|
171
177
|
state = $filter == "open" ? "opened" : $filter
|
172
178
|
|
173
|
-
|
174
|
-
$gitlab ||= Gitlab.client(:auth_token => $token, :endpoint => "https://gitlab.com/api/v4")
|
179
|
+
$gitlab ||= Gitlab.client(:auth_token => $token, :endpoint => $endpoint || "https://gitlab.com/api/v4")
|
175
180
|
methods.each do |method|
|
176
181
|
$gitlab.public_send(method, "#{user}/#{repo}", :state => state).auto_paginate do |item|
|
177
182
|
next if skip_user?(item.author.username)
|
@@ -223,27 +228,28 @@ Hashie.logger = Logger.new(File::NULL) if defined?(Hashie)
|
|
223
228
|
$exclude_users = []
|
224
229
|
$include_users = []
|
225
230
|
$export = "all"
|
231
|
+
$endpoint = nil
|
226
232
|
$filter = "open"
|
227
233
|
$provider = ENV["EPR_SERVICE"] || SERVICES[0]
|
228
234
|
$token = lookup_token
|
229
235
|
|
230
236
|
parser = OptionParser.new do |opts|
|
231
|
-
opts.banner = "usage: #{File.basename($0)} [-hv] [-s state] [-t token] [-c user1,user2...] user/repo1 [user/repo2...]"
|
237
|
+
opts.banner = "usage: #{File.basename($0)} [-hv] [-e url] [-s state] [-t token] [-c user1,user2...] user/repo1 [user/repo2...]"
|
232
238
|
|
233
239
|
opts.on "-c", "--creator=USER1,USER2,...", Array, "Export PRs created by given username(s); prepend `!' to exclude user" do |u|
|
234
240
|
$exclude_users, $include_users = u.partition { |name| name.start_with?("!") }
|
235
241
|
$exclude_users.map! { |name| name[1..-1] } # remove "!"
|
236
242
|
end
|
237
243
|
|
244
|
+
opts.on "-e", "--endpoint=URL", "Endpoint URL for 'enterprise', etc... repositories" do |url|
|
245
|
+
$endpoint = url
|
246
|
+
end
|
247
|
+
|
238
248
|
opts.on "-h", "--help", "Show this message" do
|
239
249
|
puts opts
|
240
250
|
exit
|
241
251
|
end
|
242
252
|
|
243
|
-
opts.on "-t", "--token=TOKEN", "API token" do |t|
|
244
|
-
$token = t
|
245
|
-
end
|
246
|
-
|
247
253
|
opts.on "-p, --provider=NAME", SERVICES, "Service provider: bitbucket, github, or gitlab; defaults to github" do |name|
|
248
254
|
$provider = name
|
249
255
|
end
|
@@ -252,6 +258,10 @@ parser = OptionParser.new do |opts|
|
|
252
258
|
$filter = f
|
253
259
|
end
|
254
260
|
|
261
|
+
opts.on "-t", "--token=TOKEN", "API token" do |t|
|
262
|
+
$token = t
|
263
|
+
end
|
264
|
+
|
255
265
|
opts.on "-x", "--export=WHAT", %w[pr issues all], "What to export: pr, issues, or all; defaults to all" do |x|
|
256
266
|
$export = x
|
257
267
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: export-pull-requests
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Skye Shaw
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: github_api
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
version: '0'
|
100
100
|
requirements: []
|
101
101
|
rubyforge_project:
|
102
|
-
rubygems_version: 2.
|
102
|
+
rubygems_version: 2.6.14
|
103
103
|
signing_key:
|
104
104
|
specification_version: 4
|
105
105
|
summary: Export pull requests and issues to a CSV file.
|