whatsup_github 0.4.2 → 1.0.0
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/.github/workflows/linter.yml +4 -3
- data/.github/workflows/tests.yml +11 -0
- data/.ruby-version +1 -1
- data/Gemfile.lock +76 -96
- data/README.md +39 -5
- data/Rakefile +1 -1
- data/lib/template/.whatsup.yml +7 -4
- data/lib/whatsup_github/cli.rb +12 -3
- data/lib/whatsup_github/config_reader.rb +12 -1
- data/lib/whatsup_github/enterprise_client.rb +35 -0
- data/lib/whatsup_github/pulls.rb +30 -12
- data/lib/whatsup_github/version.rb +1 -1
- data/whatsup_github.gemspec +9 -7
- metadata +46 -17
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6011fb20af5b86f2b85e7355a07bed05ee27925a4da730016e9235e5fc617b31
|
|
4
|
+
data.tar.gz: 06606d117ab0023ab99db64df32a8fb46860a7b9f225f5ab8ddfbc7b62f21423
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a702fd6f297fa9ac740166b873430da82ea1a9fbd53c71668987e26a9a616a8a53582491225fced72ce1e541273c0f0094339ca1ad0d4d6daefc089c4e1d5b08
|
|
7
|
+
data.tar.gz: f49151e889c66674200a0752c7a6b2f2e2f2c179486339b5e6e3f420cd822218f10ff9c6d8273a658ec02bec9eb6152c57a9ae1200b3623f582cd7d8b3c51d02
|
|
@@ -33,7 +33,7 @@ jobs:
|
|
|
33
33
|
# Checkout the code base #
|
|
34
34
|
##########################
|
|
35
35
|
- name: Checkout Code
|
|
36
|
-
uses: actions/checkout@
|
|
36
|
+
uses: actions/checkout@v3
|
|
37
37
|
with:
|
|
38
38
|
# Full git history is needed to get a proper list of changed files within `super-linter`
|
|
39
39
|
fetch-depth: 0
|
|
@@ -42,7 +42,8 @@ jobs:
|
|
|
42
42
|
# Run Linter against code base #
|
|
43
43
|
################################
|
|
44
44
|
- name: Lint Code Base
|
|
45
|
-
uses: github/super-linter@
|
|
45
|
+
uses: github/super-linter/slim@v4
|
|
46
46
|
env:
|
|
47
|
-
VALIDATE_ALL_CODEBASE: false
|
|
48
47
|
DEFAULT_BRANCH: main
|
|
48
|
+
VALIDATE_ALL_CODEBASE: false
|
|
49
|
+
VALIDATE_GITLEAKS: false
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
name: Test the code
|
|
2
|
+
on: [pull_request]
|
|
3
|
+
jobs:
|
|
4
|
+
test:
|
|
5
|
+
runs-on: ubuntu-latest
|
|
6
|
+
steps:
|
|
7
|
+
- uses: actions/checkout@v3
|
|
8
|
+
- uses: ruby/setup-ruby@v1
|
|
9
|
+
with:
|
|
10
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
|
11
|
+
- run: bundle exec rake
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
ruby-2.
|
|
1
|
+
ruby-2.7.7
|
data/Gemfile.lock
CHANGED
|
@@ -1,129 +1,109 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
whatsup_github (0.
|
|
4
|
+
whatsup_github (1.0.0)
|
|
5
5
|
netrc (~> 0.11)
|
|
6
|
-
octokit (~>
|
|
7
|
-
thor (~> 1.
|
|
6
|
+
octokit (~> 6.0)
|
|
7
|
+
thor (~> 1.2)
|
|
8
8
|
|
|
9
9
|
GEM
|
|
10
10
|
remote: https://rubygems.org/
|
|
11
11
|
specs:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
tzinfo (~> 2.0)
|
|
17
|
-
zeitwerk (~> 2.3)
|
|
18
|
-
addressable (2.7.0)
|
|
19
|
-
public_suffix (>= 2.0.2, < 5.0)
|
|
20
|
-
aruba (1.0.4)
|
|
12
|
+
addressable (2.8.1)
|
|
13
|
+
public_suffix (>= 2.0.2, < 6.0)
|
|
14
|
+
aruba (2.1.0)
|
|
15
|
+
bundler (>= 1.17, < 3.0)
|
|
21
16
|
childprocess (>= 2.0, < 5.0)
|
|
22
|
-
contracts (
|
|
23
|
-
cucumber (>=
|
|
17
|
+
contracts (>= 0.16.0, < 0.18.0)
|
|
18
|
+
cucumber (>= 4.0, < 9.0)
|
|
24
19
|
rspec-expectations (~> 3.4)
|
|
25
20
|
thor (~> 1.0)
|
|
26
21
|
builder (3.2.4)
|
|
27
|
-
childprocess (4.
|
|
22
|
+
childprocess (4.1.0)
|
|
28
23
|
coderay (1.1.3)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
cucumber (5.3.0)
|
|
24
|
+
contracts (0.16.1)
|
|
25
|
+
cucumber (8.0.0)
|
|
32
26
|
builder (~> 3.2, >= 3.2.4)
|
|
33
|
-
cucumber-
|
|
34
|
-
cucumber-
|
|
35
|
-
cucumber-cucumber-expressions (~>
|
|
36
|
-
cucumber-gherkin (~>
|
|
37
|
-
cucumber-html-formatter (~>
|
|
38
|
-
cucumber-messages (~>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
multi_test (~>
|
|
42
|
-
sys-uname (~> 1.2, >= 1.2.
|
|
43
|
-
cucumber-
|
|
44
|
-
|
|
45
|
-
cucumber-
|
|
46
|
-
cucumber-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
cucumber-
|
|
52
|
-
cucumber-messages (~>
|
|
53
|
-
cucumber-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
faraday-net_http (~> 1.0)
|
|
65
|
-
multipart-post (>= 1.2, < 3)
|
|
66
|
-
ruby2_keywords
|
|
67
|
-
faraday-net_http (1.0.1)
|
|
68
|
-
ffi (1.15.0)
|
|
69
|
-
i18n (1.8.9)
|
|
70
|
-
concurrent-ruby (~> 1.0)
|
|
27
|
+
cucumber-ci-environment (~> 9.0, >= 9.0.4)
|
|
28
|
+
cucumber-core (~> 11.0, >= 11.0.0)
|
|
29
|
+
cucumber-cucumber-expressions (~> 15.1, >= 15.1.1)
|
|
30
|
+
cucumber-gherkin (~> 23.0, >= 23.0.1)
|
|
31
|
+
cucumber-html-formatter (~> 19.1, >= 19.1.0)
|
|
32
|
+
cucumber-messages (~> 18.0, >= 18.0.0)
|
|
33
|
+
diff-lcs (~> 1.5, >= 1.5.0)
|
|
34
|
+
mime-types (~> 3.4, >= 3.4.1)
|
|
35
|
+
multi_test (~> 1.1, >= 1.1.0)
|
|
36
|
+
sys-uname (~> 1.2, >= 1.2.2)
|
|
37
|
+
cucumber-ci-environment (9.1.0)
|
|
38
|
+
cucumber-core (11.0.0)
|
|
39
|
+
cucumber-gherkin (~> 23.0, >= 23.0.1)
|
|
40
|
+
cucumber-messages (~> 18.0, >= 18.0.0)
|
|
41
|
+
cucumber-tag-expressions (~> 4.1, >= 4.1.0)
|
|
42
|
+
cucumber-cucumber-expressions (15.2.0)
|
|
43
|
+
cucumber-gherkin (23.0.1)
|
|
44
|
+
cucumber-messages (~> 18.0, >= 18.0.0)
|
|
45
|
+
cucumber-html-formatter (19.2.0)
|
|
46
|
+
cucumber-messages (~> 18.0, >= 18.0.0)
|
|
47
|
+
cucumber-messages (18.0.0)
|
|
48
|
+
cucumber-tag-expressions (4.1.0)
|
|
49
|
+
diff-lcs (1.5.0)
|
|
50
|
+
faraday (2.7.2)
|
|
51
|
+
faraday-net_http (>= 2.0, < 3.1)
|
|
52
|
+
ruby2_keywords (>= 0.0.4)
|
|
53
|
+
faraday-net_http (3.0.2)
|
|
54
|
+
faraday-retry (2.0.0)
|
|
55
|
+
faraday (~> 2.0)
|
|
56
|
+
ffi (1.15.5)
|
|
57
|
+
fileutils (1.7.0)
|
|
71
58
|
method_source (1.0.0)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
59
|
+
mime-types (3.4.1)
|
|
60
|
+
mime-types-data (~> 3.2015)
|
|
61
|
+
mime-types-data (3.2022.0105)
|
|
62
|
+
multi_test (1.1.0)
|
|
76
63
|
netrc (0.11.0)
|
|
77
|
-
octokit (
|
|
78
|
-
faraday (>=
|
|
79
|
-
sawyer (~> 0.
|
|
80
|
-
|
|
81
|
-
activesupport (>= 3.2)
|
|
82
|
-
middleware
|
|
83
|
-
thor
|
|
84
|
-
thread_safe
|
|
85
|
-
pry (0.14.0)
|
|
64
|
+
octokit (6.0.1)
|
|
65
|
+
faraday (>= 1, < 3)
|
|
66
|
+
sawyer (~> 0.9)
|
|
67
|
+
pry (0.14.1)
|
|
86
68
|
coderay (~> 1.1)
|
|
87
69
|
method_source (~> 1.0)
|
|
88
|
-
public_suffix (
|
|
89
|
-
rake (13.0.
|
|
90
|
-
rspec (3.
|
|
91
|
-
rspec-core (~> 3.
|
|
92
|
-
rspec-expectations (~> 3.
|
|
93
|
-
rspec-mocks (~> 3.
|
|
94
|
-
rspec-core (3.
|
|
95
|
-
rspec-support (~> 3.
|
|
96
|
-
rspec-expectations (3.
|
|
70
|
+
public_suffix (5.0.1)
|
|
71
|
+
rake (13.0.6)
|
|
72
|
+
rspec (3.12.0)
|
|
73
|
+
rspec-core (~> 3.12.0)
|
|
74
|
+
rspec-expectations (~> 3.12.0)
|
|
75
|
+
rspec-mocks (~> 3.12.0)
|
|
76
|
+
rspec-core (3.12.0)
|
|
77
|
+
rspec-support (~> 3.12.0)
|
|
78
|
+
rspec-expectations (3.12.1)
|
|
97
79
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
98
|
-
rspec-support (~> 3.
|
|
99
|
-
rspec-mocks (3.
|
|
80
|
+
rspec-support (~> 3.12.0)
|
|
81
|
+
rspec-mocks (3.12.1)
|
|
100
82
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
101
|
-
rspec-support (~> 3.
|
|
102
|
-
rspec-support (3.
|
|
103
|
-
ruby2_keywords (0.0.
|
|
104
|
-
sawyer (0.
|
|
83
|
+
rspec-support (~> 3.12.0)
|
|
84
|
+
rspec-support (3.12.0)
|
|
85
|
+
ruby2_keywords (0.0.5)
|
|
86
|
+
sawyer (0.9.2)
|
|
105
87
|
addressable (>= 2.3.5)
|
|
106
|
-
faraday (
|
|
88
|
+
faraday (>= 0.17.3, < 3)
|
|
107
89
|
sys-uname (1.2.2)
|
|
108
90
|
ffi (~> 1.1)
|
|
109
|
-
thor (1.1
|
|
110
|
-
thread_safe (0.3.6)
|
|
111
|
-
tzinfo (2.0.4)
|
|
112
|
-
concurrent-ruby (~> 1.0)
|
|
113
|
-
zeitwerk (2.4.2)
|
|
91
|
+
thor (1.2.1)
|
|
114
92
|
|
|
115
93
|
PLATFORMS
|
|
94
|
+
arm64-darwin-22
|
|
116
95
|
ruby
|
|
117
|
-
x86_64-darwin-19
|
|
118
96
|
|
|
119
97
|
DEPENDENCIES
|
|
120
|
-
aruba (~> 1
|
|
121
|
-
bundler (~> 2.
|
|
122
|
-
cucumber (~>
|
|
98
|
+
aruba (~> 2.1)
|
|
99
|
+
bundler (~> 2.1)
|
|
100
|
+
cucumber (~> 8.0)
|
|
101
|
+
faraday-retry (~> 2.0)
|
|
102
|
+
fileutils (~> 1.7)
|
|
123
103
|
pry (~> 0.14)
|
|
124
104
|
rake (~> 13.0)
|
|
125
|
-
rspec (~> 3.
|
|
105
|
+
rspec (~> 3.12)
|
|
126
106
|
whatsup_github!
|
|
127
107
|
|
|
128
108
|
BUNDLED WITH
|
|
129
|
-
2.
|
|
109
|
+
2.1.4
|
data/README.md
CHANGED
|
@@ -9,6 +9,22 @@ One pull request sources one data entity.
|
|
|
9
9
|
All filtering parameters are set in a configuration file, except dates.
|
|
10
10
|
_Since_ date is set as a CLI argument and the _till_ date is always the moment when the command is run.
|
|
11
11
|
|
|
12
|
+
## CLI
|
|
13
|
+
|
|
14
|
+
```console
|
|
15
|
+
Commands:
|
|
16
|
+
whatsup_github help [COMMAND] # Describe available commands or one specific command
|
|
17
|
+
whatsup_github since DATE # Filters pull requests since the specified date till now. Default: last 7 days.
|
|
18
|
+
whatsup_github version # Current version of the gem
|
|
19
|
+
|
|
20
|
+
Usage:
|
|
21
|
+
whatsup_github since DATE
|
|
22
|
+
|
|
23
|
+
Options:
|
|
24
|
+
[--config=CONFIG] # Relative path to the configuration file.
|
|
25
|
+
# Default: .whatsup.yml
|
|
26
|
+
```
|
|
27
|
+
|
|
12
28
|
## What's generated
|
|
13
29
|
|
|
14
30
|
A resulting YAML file `tmp/whats-new.yml` is generated from GitHub data.
|
|
@@ -38,7 +54,7 @@ Set as a list of `labels` in `.whatsup.yml`. There are two types of labels in co
|
|
|
38
54
|
|
|
39
55
|
### `versions`
|
|
40
56
|
|
|
41
|
-
Any GitHub label that starts from a digit followed by a period like in
|
|
57
|
+
Any GitHub label that starts from a digit followed by a period like in regular expression `\d\.`.
|
|
42
58
|
Examples: `2.3.x`, `1.0.3-msi`, `2.x`
|
|
43
59
|
|
|
44
60
|
### `date`
|
|
@@ -59,7 +75,7 @@ Merge commit SHA of the pull request.
|
|
|
59
75
|
|
|
60
76
|
### `membership`
|
|
61
77
|
|
|
62
|
-
|
|
78
|
+
Membership of the contributor in a configured organization.
|
|
63
79
|
|
|
64
80
|
### `labels`
|
|
65
81
|
|
|
@@ -91,7 +107,13 @@ bundle
|
|
|
91
107
|
|
|
92
108
|
## Configuration
|
|
93
109
|
|
|
94
|
-
The configuration file [`.whatsup.yml`](lib/template/.whatsup.yml) will be created automatically after first run unless it's already there.
|
|
110
|
+
The default configuration file [`.whatsup.yml`](lib/template/.whatsup.yml) will be created automatically after first run unless it's already there.
|
|
111
|
+
|
|
112
|
+
To use non-default location or name of the file, use the --config option. Example:
|
|
113
|
+
|
|
114
|
+
```shell
|
|
115
|
+
whatsup_github since 'apr 9' --config 'configs/whatsup_bp.yml'
|
|
116
|
+
```
|
|
95
117
|
|
|
96
118
|
## Authentication
|
|
97
119
|
|
|
@@ -109,8 +131,20 @@ Example:
|
|
|
109
131
|
|
|
110
132
|
```config
|
|
111
133
|
machine api.github.com
|
|
112
|
-
login
|
|
134
|
+
login mypubliclogin
|
|
135
|
+
password y9o6YvEoa7IukRWUFdnkpuxNjJ3uwiDQp4zkAdU0
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Example with GitHub Enterprise:
|
|
139
|
+
|
|
140
|
+
```config
|
|
141
|
+
machine api.github.com
|
|
142
|
+
login mypubliclogin
|
|
113
143
|
password y9o6YvEoa7IukRWUFdnkpuxNjJ3uwiDQp4zkAdU0
|
|
144
|
+
|
|
145
|
+
machine git.enterprise.example.com
|
|
146
|
+
login myenterpriselogin
|
|
147
|
+
password GtH7yhvEoa7Iuksdo&TFuxNjJ3uwiDQhjbiu8&yhJhG
|
|
114
148
|
```
|
|
115
149
|
|
|
116
150
|
### With an environment variable
|
|
@@ -202,7 +236,7 @@ The tests use the root `.whatsup.yml` file to read configuration.
|
|
|
202
236
|
|
|
203
237
|
## Contributing
|
|
204
238
|
|
|
205
|
-
Bug reports and pull requests are welcome
|
|
239
|
+
Bug reports and pull requests are welcome. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
206
240
|
|
|
207
241
|
## License
|
|
208
242
|
|
data/Rakefile
CHANGED
data/lib/template/.whatsup.yml
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
# Parameters for a GitHub search query
|
|
2
2
|
base_branch: master
|
|
3
3
|
|
|
4
|
+
# Set hostname to read repos at GitHub Enterprise
|
|
5
|
+
# enterprise: <hostname>
|
|
6
|
+
|
|
4
7
|
# The list of repositories to scan for pull requests
|
|
8
|
+
# For repos at GitHub Enterprise, add a prefix 'enterprise:'. Example: enterprise:magento/devdocs.
|
|
5
9
|
repos:
|
|
6
10
|
- magento/devdocs
|
|
7
|
-
- magento-commerce/devdocs
|
|
8
11
|
|
|
9
12
|
# Labels also will be used as a 'type' value in the output file
|
|
10
13
|
labels:
|
|
@@ -19,10 +22,10 @@ output_format:
|
|
|
19
22
|
- yaml
|
|
20
23
|
# - markdown
|
|
21
24
|
|
|
22
|
-
# The phrase that is used as a separator in the pull request
|
|
25
|
+
# The phrase that is used as a separator in the pull request description.
|
|
23
26
|
# All the lines that follows this phrase are captured as 'description' for this PR's entry in the resulted data file.
|
|
24
27
|
magic_word: whatsnew
|
|
25
28
|
|
|
26
29
|
# An organization to check a contributor for membership.
|
|
27
|
-
# Values: 'true', 'false',
|
|
28
|
-
membership: magento-commerce
|
|
30
|
+
# Values: 'true', 'false', empty if not configured.
|
|
31
|
+
# membership: magento-commerce
|
data/lib/whatsup_github/cli.rb
CHANGED
|
@@ -2,14 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
require 'thor'
|
|
4
4
|
require 'whatsup_github/runner'
|
|
5
|
+
require 'whatsup_github/version'
|
|
5
6
|
module WhatsupGithub
|
|
7
|
+
# CLI options
|
|
6
8
|
class CLI < Thor
|
|
7
|
-
desc 'since DATE', 'Filters pull requests since the specified date till now.'
|
|
8
|
-
|
|
9
|
+
desc 'since DATE', 'Filters pull requests since the specified date till now. Default: last 7 days.'
|
|
10
|
+
option :config,
|
|
11
|
+
desc: 'Relative path to the configuration file.',
|
|
12
|
+
default: '.whatsup.yml'
|
|
9
13
|
def since(date = Date.today - 7)
|
|
14
|
+
WhatsupGithub::Config.filename = options[:config]
|
|
10
15
|
runner = WhatsupGithub::Runner.new(Date.parse(date.to_s))
|
|
11
16
|
runner.run
|
|
12
17
|
end
|
|
13
|
-
|
|
18
|
+
|
|
19
|
+
desc 'version', 'Current version of the gem'
|
|
20
|
+
def version
|
|
21
|
+
puts "Current version is #{WhatsupGithub::VERSION}"
|
|
22
|
+
end
|
|
14
23
|
end
|
|
15
24
|
end
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require 'yaml'
|
|
4
4
|
require 'singleton'
|
|
5
|
+
require 'fileutils'
|
|
5
6
|
|
|
6
7
|
module WhatsupGithub
|
|
7
8
|
# Creates readable objects from confirurarion files
|
|
@@ -10,8 +11,14 @@ module WhatsupGithub
|
|
|
10
11
|
|
|
11
12
|
include Singleton
|
|
12
13
|
|
|
14
|
+
@@filename = ''
|
|
15
|
+
|
|
16
|
+
def self.filename=(filename)
|
|
17
|
+
@@filename = filename
|
|
18
|
+
end
|
|
19
|
+
|
|
13
20
|
def initialize
|
|
14
|
-
@file =
|
|
21
|
+
@file = @@filename
|
|
15
22
|
@config = {}
|
|
16
23
|
end
|
|
17
24
|
|
|
@@ -63,6 +70,10 @@ module WhatsupGithub
|
|
|
63
70
|
def magic_word
|
|
64
71
|
read['magic_word']
|
|
65
72
|
end
|
|
73
|
+
|
|
74
|
+
def enterprise
|
|
75
|
+
read['enterprise']
|
|
76
|
+
end
|
|
66
77
|
end
|
|
67
78
|
end
|
|
68
79
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'singleton'
|
|
4
|
+
|
|
5
|
+
# Client authorization
|
|
6
|
+
module WhatsupGithub
|
|
7
|
+
# Create a singleton object for EnterpriseClient.
|
|
8
|
+
# Authorize with a GitHub Enterprise token from $WHATSUP_ENTERPRISE_ACCESS_TOKEN if available
|
|
9
|
+
# Otherwise, use credentials from ~/.netrc
|
|
10
|
+
class EnterpriseClient < Client
|
|
11
|
+
include Singleton
|
|
12
|
+
|
|
13
|
+
WHATSUP_ENTERPRISE_ACCESS_TOKEN = ENV['WHATSUP_ENTERPRISE_ACCESS_TOKEN']
|
|
14
|
+
private_constant :WHATSUP_ENTERPRISE_ACCESS_TOKEN
|
|
15
|
+
|
|
16
|
+
@@hostname = ''
|
|
17
|
+
|
|
18
|
+
def self.host=(hostname)
|
|
19
|
+
abort "ERROR: Set value for 'enterprise' in the whatsup_github configuration" if hostname.nil?
|
|
20
|
+
@@hostname = hostname
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def initialize
|
|
24
|
+
Octokit.configure do |c|
|
|
25
|
+
c.api_endpoint = "https://#{@@hostname}/api/v3/"
|
|
26
|
+
end
|
|
27
|
+
@client =
|
|
28
|
+
if WHATSUP_ENTERPRISE_ACCESS_TOKEN
|
|
29
|
+
Octokit::Client.new(access_token: WHATSUP_ENTERPRISE_ACCESS_TOKEN)
|
|
30
|
+
elsif File.exist? "#{ENV['HOME']}/.netrc"
|
|
31
|
+
Octokit::Client.new(netrc: true)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
data/lib/whatsup_github/pulls.rb
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require 'octokit'
|
|
4
4
|
require_relative 'config_reader'
|
|
5
5
|
require_relative 'client'
|
|
6
|
+
require_relative 'enterprise_client'
|
|
6
7
|
|
|
7
8
|
module WhatsupGithub
|
|
8
9
|
# Gets issues found on GitHub by query
|
|
@@ -24,10 +25,6 @@ module WhatsupGithub
|
|
|
24
25
|
|
|
25
26
|
private
|
|
26
27
|
|
|
27
|
-
# def access_token
|
|
28
|
-
# credentials.dig 'github_token'
|
|
29
|
-
# end
|
|
30
|
-
|
|
31
28
|
def configuration
|
|
32
29
|
Config.instance
|
|
33
30
|
end
|
|
@@ -48,25 +45,46 @@ module WhatsupGithub
|
|
|
48
45
|
configuration.base_branch
|
|
49
46
|
end
|
|
50
47
|
|
|
51
|
-
# Authorize with a GitHub token from $WHATSUP_GITHUB_ACCESS_TOKEN if available
|
|
52
|
-
# Otherwise, use credentials from ~/.netrc
|
|
53
|
-
# Otherwise, continue as a Guest
|
|
54
48
|
def client
|
|
55
49
|
Client.instance
|
|
56
50
|
end
|
|
57
51
|
|
|
52
|
+
def enterprise_client
|
|
53
|
+
WhatsupGithub::EnterpriseClient.host = configuration.enterprise
|
|
54
|
+
EnterpriseClient.instance
|
|
55
|
+
end
|
|
56
|
+
|
|
58
57
|
def search_issues(label)
|
|
59
58
|
auto_paginate
|
|
60
|
-
query
|
|
61
|
-
puts "Searching on GitHub by query #{query}"
|
|
62
|
-
client.search_issues(query)
|
|
59
|
+
call_query query(label)
|
|
63
60
|
end
|
|
64
61
|
|
|
65
62
|
def search_issues_with_magic_word(label)
|
|
66
63
|
auto_paginate
|
|
67
|
-
|
|
64
|
+
call_query query_with_magic_word(label)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def call_query(query)
|
|
68
68
|
puts "Searching on GitHub by query #{query}"
|
|
69
|
-
|
|
69
|
+
if repo.start_with? 'enterprise:'
|
|
70
|
+
enterprise_client.search_issues(
|
|
71
|
+
enterprise_query(query)
|
|
72
|
+
)
|
|
73
|
+
else
|
|
74
|
+
client.search_issues(query)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def enterprise_query(query)
|
|
79
|
+
query.gsub('enterprise:', '')
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def query(label)
|
|
83
|
+
"repo:#{repo} label:\"#{label}\" merged:>=#{since} base:#{base_branch} is:pull-request"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def query_with_magic_word(label)
|
|
87
|
+
query(label) + " \"#{magic_word}\" in:body"
|
|
70
88
|
end
|
|
71
89
|
|
|
72
90
|
def auto_paginate
|
data/whatsup_github.gemspec
CHANGED
|
@@ -34,16 +34,18 @@ Gem::Specification.new do |spec|
|
|
|
34
34
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
35
35
|
spec.require_paths = ['lib']
|
|
36
36
|
|
|
37
|
-
spec.required_ruby_version = '>= 2.
|
|
37
|
+
spec.required_ruby_version = '>= 2.7.0'
|
|
38
38
|
|
|
39
39
|
spec.add_dependency 'netrc', '~> 0.11'
|
|
40
|
-
spec.add_dependency 'octokit', '~>
|
|
41
|
-
spec.add_dependency 'thor', '~> 1.
|
|
40
|
+
spec.add_dependency 'octokit', '~> 6.0'
|
|
41
|
+
spec.add_dependency 'thor', '~> 1.2'
|
|
42
42
|
|
|
43
|
-
spec.add_development_dependency 'aruba', '~> 1
|
|
44
|
-
spec.add_development_dependency 'bundler', '~> 2.
|
|
45
|
-
spec.add_development_dependency 'cucumber', '~>
|
|
43
|
+
spec.add_development_dependency 'aruba', '~> 2.1'
|
|
44
|
+
spec.add_development_dependency 'bundler', '~> 2.1'
|
|
45
|
+
spec.add_development_dependency 'cucumber', '~> 8.0'
|
|
46
46
|
spec.add_development_dependency 'pry', '~> 0.14'
|
|
47
47
|
spec.add_development_dependency 'rake', '~> 13.0'
|
|
48
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
|
48
|
+
spec.add_development_dependency 'rspec', '~> 3.12'
|
|
49
|
+
spec.add_development_dependency 'fileutils', '~> 1.7'
|
|
50
|
+
spec.add_development_dependency 'faraday-retry', '~> 2.0'
|
|
49
51
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: whatsup_github
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dima Shevtsov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-01-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: netrc
|
|
@@ -30,70 +30,70 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
33
|
+
version: '6.0'
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
40
|
+
version: '6.0'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: thor
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '1.
|
|
47
|
+
version: '1.2'
|
|
48
48
|
type: :runtime
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '1.
|
|
54
|
+
version: '1.2'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: aruba
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
59
|
- - "~>"
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '1
|
|
61
|
+
version: '2.1'
|
|
62
62
|
type: :development
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
66
|
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '1
|
|
68
|
+
version: '2.1'
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
70
|
name: bundler
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
|
73
73
|
- - "~>"
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '2.
|
|
75
|
+
version: '2.1'
|
|
76
76
|
type: :development
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
80
|
- - "~>"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: '2.
|
|
82
|
+
version: '2.1'
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
84
|
name: cucumber
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
86
86
|
requirements:
|
|
87
87
|
- - "~>"
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: '
|
|
89
|
+
version: '8.0'
|
|
90
90
|
type: :development
|
|
91
91
|
prerelease: false
|
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
93
|
requirements:
|
|
94
94
|
- - "~>"
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: '
|
|
96
|
+
version: '8.0'
|
|
97
97
|
- !ruby/object:Gem::Dependency
|
|
98
98
|
name: pry
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -128,14 +128,42 @@ dependencies:
|
|
|
128
128
|
requirements:
|
|
129
129
|
- - "~>"
|
|
130
130
|
- !ruby/object:Gem::Version
|
|
131
|
-
version: '3.
|
|
131
|
+
version: '3.12'
|
|
132
132
|
type: :development
|
|
133
133
|
prerelease: false
|
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
|
135
135
|
requirements:
|
|
136
136
|
- - "~>"
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
|
-
version: '3.
|
|
138
|
+
version: '3.12'
|
|
139
|
+
- !ruby/object:Gem::Dependency
|
|
140
|
+
name: fileutils
|
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
|
142
|
+
requirements:
|
|
143
|
+
- - "~>"
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: '1.7'
|
|
146
|
+
type: :development
|
|
147
|
+
prerelease: false
|
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
150
|
+
- - "~>"
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: '1.7'
|
|
153
|
+
- !ruby/object:Gem::Dependency
|
|
154
|
+
name: faraday-retry
|
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
|
156
|
+
requirements:
|
|
157
|
+
- - "~>"
|
|
158
|
+
- !ruby/object:Gem::Version
|
|
159
|
+
version: '2.0'
|
|
160
|
+
type: :development
|
|
161
|
+
prerelease: false
|
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
163
|
+
requirements:
|
|
164
|
+
- - "~>"
|
|
165
|
+
- !ruby/object:Gem::Version
|
|
166
|
+
version: '2.0'
|
|
139
167
|
description:
|
|
140
168
|
email:
|
|
141
169
|
- shevtsov@adobe.com
|
|
@@ -146,10 +174,10 @@ extra_rdoc_files: []
|
|
|
146
174
|
files:
|
|
147
175
|
- ".github/linters/.ruby-lint.yml"
|
|
148
176
|
- ".github/workflows/linter.yml"
|
|
177
|
+
- ".github/workflows/tests.yml"
|
|
149
178
|
- ".gitignore"
|
|
150
179
|
- ".rspec"
|
|
151
180
|
- ".ruby-version"
|
|
152
|
-
- ".travis.yml"
|
|
153
181
|
- CHANGELOG.md
|
|
154
182
|
- Gemfile
|
|
155
183
|
- Gemfile.lock
|
|
@@ -164,6 +192,7 @@ files:
|
|
|
164
192
|
- lib/whatsup_github/cli.rb
|
|
165
193
|
- lib/whatsup_github/client.rb
|
|
166
194
|
- lib/whatsup_github/config_reader.rb
|
|
195
|
+
- lib/whatsup_github/enterprise_client.rb
|
|
167
196
|
- lib/whatsup_github/generator.rb
|
|
168
197
|
- lib/whatsup_github/pulls.rb
|
|
169
198
|
- lib/whatsup_github/row.rb
|
|
@@ -188,14 +217,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
188
217
|
requirements:
|
|
189
218
|
- - ">="
|
|
190
219
|
- !ruby/object:Gem::Version
|
|
191
|
-
version: 2.
|
|
220
|
+
version: 2.7.0
|
|
192
221
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
222
|
requirements:
|
|
194
223
|
- - ">="
|
|
195
224
|
- !ruby/object:Gem::Version
|
|
196
225
|
version: '0'
|
|
197
226
|
requirements: []
|
|
198
|
-
rubygems_version: 3.
|
|
227
|
+
rubygems_version: 3.1.6
|
|
199
228
|
signing_key:
|
|
200
229
|
specification_version: 4
|
|
201
230
|
summary: Collect info from GitHub pull requests.
|