gitlab_awesome_release 0.1.1 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.env.gitlab.example +1 -1
- data/.gitignore +1 -0
- data/.gitlab-ci.yml +49 -36
- data/.rubocop.yml +12 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +54 -1
- data/Gemfile +7 -0
- data/README.md +9 -7
- data/gitlab-ci/config +4 -0
- data/gitlab-ci/setup.sh +9 -1
- data/gitlab_awesome_release.gemspec +7 -7
- data/lib/gitlab_awesome_release/cli.rb +4 -4
- data/lib/gitlab_awesome_release/gitlab_logging_ext.rb +1 -1
- data/lib/gitlab_awesome_release/project.rb +23 -26
- data/lib/gitlab_awesome_release/version.rb +1 -1
- metadata +27 -14
- data/gitlab-ci/rubocop.sh +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cc883b30e29624a6142a294bbc9bb6b34c9b6bc08d0a91ce5447729659ba0bdb
|
4
|
+
data.tar.gz: d71375698195d481dcddbd7b380f067d2e45a7957d1e1d23311ca42ff90231a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa029fc2109fcc670a5d8894d44e1852a8752f038f1bbee981ad6843124cace6712a7301344f394489c5a5c3e213bb19b43b0bea19d54f166c6c07c8ef78255c
|
7
|
+
data.tar.gz: 4aede8475c7c84a6a2c8337ada8809489697ae95eb570fa69be274a894a23e6cdb71436fd9bceb1310a2ebc96adec89069670c3173a922d9cc6e1596719e2a9c
|
data/.env.gitlab.example
CHANGED
data/.gitignore
CHANGED
data/.gitlab-ci.yml
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
stages:
|
2
2
|
- test
|
3
|
+
- deploy
|
3
4
|
|
4
|
-
.
|
5
|
+
.default:
|
5
6
|
variables:
|
6
|
-
CI: "true"
|
7
7
|
BUNDLE_CACHE: "vendor/bundle/"
|
8
8
|
|
9
9
|
cache:
|
10
|
-
untracked: true
|
11
10
|
key: "$CI_BUILD_NAME"
|
12
11
|
paths:
|
13
12
|
- vendor/bundle/
|
@@ -21,66 +20,80 @@ stages:
|
|
21
20
|
- tags
|
22
21
|
|
23
22
|
ruby2.1:rspec:
|
24
|
-
|
25
|
-
image:
|
23
|
+
extends: .default
|
24
|
+
image: ruby:2.1
|
26
25
|
|
27
26
|
script:
|
28
27
|
- ./gitlab-ci/rspec.sh
|
29
28
|
|
30
|
-
ruby2.
|
31
|
-
|
32
|
-
image:
|
29
|
+
ruby2.2:rspec:
|
30
|
+
extends: .default
|
31
|
+
image: ruby:2.2
|
33
32
|
|
34
33
|
script:
|
35
|
-
- ./gitlab-ci/
|
36
|
-
|
37
|
-
allow_failure: true
|
34
|
+
- ./gitlab-ci/rspec.sh
|
38
35
|
|
39
|
-
ruby2.
|
40
|
-
|
41
|
-
image:
|
36
|
+
ruby2.3:rspec:
|
37
|
+
extends: .default
|
38
|
+
image: ruby:2.3
|
42
39
|
|
43
40
|
script:
|
44
41
|
- ./gitlab-ci/rspec.sh
|
45
42
|
|
46
|
-
ruby2.
|
47
|
-
|
48
|
-
|
49
|
-
image: drecom/centos-ruby:2.2.6
|
43
|
+
ruby2.4:rspec:
|
44
|
+
extends: .default
|
45
|
+
image: ruby:2.4
|
50
46
|
|
51
47
|
script:
|
52
|
-
- ./gitlab-ci/
|
53
|
-
|
54
|
-
allow_failure: true
|
48
|
+
- ./gitlab-ci/rspec.sh
|
55
49
|
|
56
|
-
ruby2.
|
57
|
-
|
58
|
-
image:
|
50
|
+
ruby2.5:rspec:
|
51
|
+
extends: .default
|
52
|
+
image: ruby:2.5
|
59
53
|
|
60
54
|
script:
|
61
55
|
- ./gitlab-ci/rspec.sh
|
62
56
|
|
63
|
-
ruby2.
|
64
|
-
|
65
|
-
image:
|
57
|
+
ruby2.6:rspec:
|
58
|
+
extends: .default
|
59
|
+
image: ruby:2.6
|
66
60
|
|
67
61
|
script:
|
68
|
-
- ./gitlab-ci/
|
62
|
+
- ./gitlab-ci/rspec.sh
|
69
63
|
|
70
|
-
|
64
|
+
ruby2.7:rspec:
|
65
|
+
extends: .default
|
66
|
+
image: ruby:2.7
|
71
67
|
|
72
|
-
|
73
|
-
|
74
|
-
|
68
|
+
script:
|
69
|
+
- ./gitlab-ci/rspec.sh
|
70
|
+
|
71
|
+
ruby3.0:rspec:
|
72
|
+
extends: .default
|
73
|
+
image: ruby:3.0
|
75
74
|
|
76
75
|
script:
|
77
76
|
- ./gitlab-ci/rspec.sh
|
78
77
|
|
79
|
-
|
80
|
-
|
81
|
-
image:
|
78
|
+
rubocop:
|
79
|
+
extends: .default
|
80
|
+
image: ruby
|
82
81
|
|
83
82
|
script:
|
84
|
-
-
|
83
|
+
- bundle exec rubocop
|
85
84
|
|
86
85
|
allow_failure: true
|
86
|
+
|
87
|
+
pages:
|
88
|
+
extends: .default
|
89
|
+
image: ruby
|
90
|
+
|
91
|
+
stage: deploy
|
92
|
+
|
93
|
+
script:
|
94
|
+
- bundle exec yard
|
95
|
+
artifacts:
|
96
|
+
paths:
|
97
|
+
- public
|
98
|
+
only:
|
99
|
+
- master
|
data/.rubocop.yml
CHANGED
@@ -4,5 +4,17 @@ inherit_gem:
|
|
4
4
|
AllCops:
|
5
5
|
TargetRubyVersion: 2.4
|
6
6
|
|
7
|
+
Gemspec/RequiredRubyVersion:
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
Layout/AlignHash:
|
11
|
+
EnforcedColonStyle: table
|
12
|
+
|
13
|
+
Layout/ClosingHeredocIndentation:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
Layout/IndentHeredoc:
|
17
|
+
Enabled: false
|
18
|
+
|
7
19
|
Metrics/ClassLength:
|
8
20
|
Max: 130
|
data/.yardopts
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,59 @@
|
|
1
1
|
## Unreleased
|
2
|
-
[full changelog](https://gitlab.com/sue445/gitlab_awesome_release/compare/
|
2
|
+
[full changelog](https://gitlab.com/sue445/gitlab_awesome_release/compare/v1.0.3...master)
|
3
3
|
|
4
|
+
## v1.0.3
|
5
|
+
[full changelog](https://gitlab.com/sue445/gitlab_awesome_release/compare/v1.0.2...v1.0.3)
|
6
|
+
|
7
|
+
### Bugfix
|
8
|
+
* Bugfixed. 404 Not Found error when contains other repo's merge commit [!43](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/43) *@sue445*
|
9
|
+
|
10
|
+
### Others
|
11
|
+
* CI against ruby 2.7 [!41](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/41) *@sue445*
|
12
|
+
* CI against for Ruby 3.0 [!42](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/42) *@sue445*
|
13
|
+
|
14
|
+
## v1.0.2
|
15
|
+
[full changelog](https://gitlab.com/sue445/gitlab_awesome_release/compare/v1.0.1...v1.0.2)
|
16
|
+
|
17
|
+
### Bugfix
|
18
|
+
* Fixed SEGV on ruby 2.6.0 [!39](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/39) *@sue445*
|
19
|
+
|
20
|
+
### Others
|
21
|
+
* CI against ruby 2.5 [!33](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/33) *@sue445*
|
22
|
+
* Setup Dependency Scanning [!34](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/34) *@sue445*
|
23
|
+
* Fixed failed CI on ruby < 2.3 [!35](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/35) *@sue445*
|
24
|
+
* Fix CI [!36](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/36) *@sue445*
|
25
|
+
* Update rubocop [!37](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/37) *@sue445*
|
26
|
+
* Relax bundler dependency [!38](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/38) *@sue445*
|
27
|
+
|
28
|
+
## v1.0.1
|
29
|
+
[full changelog](https://gitlab.com/sue445/gitlab_awesome_release/compare/v1.0.0...v1.0.1)
|
30
|
+
|
31
|
+
* Deploy yard to GitLab Pages [!29](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/29) *@sue445*
|
32
|
+
* Tweak .gitlab-ci.yml [!30](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/30) *@sue445*
|
33
|
+
* Support new merge commit format for GitLab v10.0.0+ [!31](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/31) *@sue445*
|
34
|
+
* Refactor .gitlab-ci.yml [!32](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/32) *@sue445*
|
35
|
+
|
36
|
+
## v1.0.0
|
37
|
+
[full changelog](https://gitlab.com/sue445/gitlab_awesome_release/compare/v0.1.2...v1.0.0)
|
38
|
+
|
39
|
+
* :warning: Drop support GitLab API v3 and support GitLab API v4 [!28](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/28) *@sue445*
|
40
|
+
|
41
|
+
## v0.1.2
|
42
|
+
[full changelog](https://gitlab.com/sue445/gitlab_awesome_release/compare/v0.1.1...v0.1.2)
|
43
|
+
|
44
|
+
* Run rubocop only latest ruby [!26](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/26) *@sue445*
|
45
|
+
* Fixed. can not call GitLab API using gitlab v4+ [!27](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/27) *@sue445*
|
46
|
+
|
47
|
+
## v0.1.1
|
48
|
+
[full changelog](https://gitlab.com/sue445/gitlab_awesome_release/compare/v0.1.0...v0.1.1)
|
49
|
+
|
50
|
+
* Use ci cache [!19](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/19) *@sue445*
|
51
|
+
* Tweak gitlab-ci [!20](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/20) *@sue445*
|
52
|
+
* Add rubocop [!21](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/21) *@sue445*
|
53
|
+
* Use ruby 2.3.1 [!22](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/22) *@sue445*
|
54
|
+
* CI against ruby 2.1, 2.2, 2.3 and 2.4 [!23](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/23) *@sue445*
|
55
|
+
* Remove activesupport from dependency :put_litter_in_its_place: [!24](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/24) *@sue445*
|
56
|
+
* update onkcop [!25](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/25) *@sue445*
|
4
57
|
|
5
58
|
## v0.1.0
|
6
59
|
[full changelog](https://gitlab.com/sue445/gitlab_awesome_release/compare/v0.1.0.beta8...v0.1.0)
|
data/Gemfile
CHANGED
@@ -2,3 +2,10 @@ source "https://rubygems.org"
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in gitlab_awesome_release.gemspec
|
4
4
|
gemspec
|
5
|
+
|
6
|
+
if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.3.0")
|
7
|
+
group :development do
|
8
|
+
# NOTE: gitlab 4.6.0+ requires ruby 2.3.0+
|
9
|
+
gem "gitlab", "< 4.6.0"
|
10
|
+
end
|
11
|
+
end
|
data/README.md
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
Generate changelog from tags and MergeRequests on [GitLab](https://about.gitlab.com/)
|
3
3
|
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/gitlab_awesome_release.svg)](https://badge.fury.io/rb/gitlab_awesome_release)
|
5
|
-
[![
|
5
|
+
[![pipeline status](https://gitlab.com/sue445/gitlab_awesome_release/badges/master/pipeline.svg)](https://gitlab.com/sue445/gitlab_awesome_release/commits/master)
|
6
|
+
[![coverage report](https://gitlab.com/sue445/gitlab_awesome_release/badges/master/coverage.svg)](https://gitlab.com/sue445/gitlab_awesome_release/commits/master)
|
6
7
|
|
7
8
|
This is inspired by [GitHub Changelog Generator](https://github.com/skywinder/github-changelog-generator)
|
8
9
|
|
@@ -12,7 +13,8 @@ see [CHANGELOG.md](CHANGELOG.md)
|
|
12
13
|
## Requirements
|
13
14
|
|
14
15
|
* Ruby v2.1+
|
15
|
-
* GitLab
|
16
|
+
* GitLab v9.0.0+
|
17
|
+
* GitLab API v4
|
16
18
|
|
17
19
|
## Installation
|
18
20
|
|
@@ -43,7 +45,7 @@ $ gitlab_awesome_release create_note --filename=CHANGELOG.md
|
|
43
45
|
All options can be specified in both the command arguments and environment variables
|
44
46
|
|
45
47
|
* `--gitlab-api-endpoint` , `GITLAB_API_ENDPOINT` **(either one is required)**
|
46
|
-
* GitLab API endpoint (e.g. `http://example.com/api/
|
48
|
+
* GitLab API endpoint (e.g. `http://example.com/api/v4`)
|
47
49
|
* `--gitlab-api-private-token` , `GITLAB_API_PRIVATE_TOKEN` **(either one is required)**
|
48
50
|
* Your private token. see [/profile/account](img/private_token.png)
|
49
51
|
* `--gitlab-project-name` , `GITLAB_PROJECT_NAME` **(either one is required)**
|
@@ -75,7 +77,7 @@ $ gitlab_awesome_release create_latest_note
|
|
75
77
|
All options can be specified in both the command arguments and environment variables
|
76
78
|
|
77
79
|
* `--gitlab-api-endpoint` , `GITLAB_API_ENDPOINT` **(either one is required)**
|
78
|
-
* GitLab API endpoint (e.g. `http://example.com/api/
|
80
|
+
* GitLab API endpoint (e.g. `http://example.com/api/v4`)
|
79
81
|
* `--gitlab-api-private-token` , `GITLAB_API_PRIVATE_TOKEN` **(either one is required)**
|
80
82
|
* Your private token. see [/profile/account](img/private_token.png)
|
81
83
|
* `--gitlab-project-name` , `GITLAB_PROJECT_NAME` **(either one is required)**
|
@@ -103,7 +105,7 @@ $ gitlab_awesome_release marking --from-tag=v0.1.0 --to-tag=v0.2.0
|
|
103
105
|
All options can be specified in both the command arguments and environment variables
|
104
106
|
|
105
107
|
* `--gitlab-api-endpoint` , `GITLAB_API_ENDPOINT` **(either one is required)**
|
106
|
-
* GitLab API endpoint (e.g. `http://example.com/api/
|
108
|
+
* GitLab API endpoint (e.g. `http://example.com/api/v4`)
|
107
109
|
* `--gitlab-api-private-token` , `GITLAB_API_PRIVATE_TOKEN` **(either one is required)**
|
108
110
|
* Your private token. see [/profile/account](img/private_token.png)
|
109
111
|
* `--gitlab-project-name` , `GITLAB_PROJECT_NAME` **(either one is required)**
|
@@ -122,10 +124,10 @@ All options can be specified in both the command arguments and environment varia
|
|
122
124
|
## ProTip
|
123
125
|
Environment variables read from `~/.env.gitlab` and current `.env.gitlab`
|
124
126
|
|
125
|
-
`~/.env.gitlab`
|
127
|
+
`~/.env.gitlab`
|
126
128
|
|
127
129
|
```
|
128
|
-
GITLAB_API_ENDPOINT=http://example.com/api/
|
130
|
+
GITLAB_API_ENDPOINT=http://example.com/api/v4
|
129
131
|
GITLAB_API_PRIVATE_TOKEN=XXXXXXXXXXXXXXXXXXX
|
130
132
|
ALLOW_TAG_FORMAT=^v?[\d.]+
|
131
133
|
```
|
data/gitlab-ci/config
ADDED
data/gitlab-ci/setup.sh
CHANGED
@@ -1,3 +1,11 @@
|
|
1
1
|
#!/bin/bash -xe
|
2
2
|
|
3
|
-
|
3
|
+
mkdir -p .bundle/
|
4
|
+
cp gitlab-ci/config .bundle/
|
5
|
+
|
6
|
+
ruby --version
|
7
|
+
gem --version
|
8
|
+
bundle --version
|
9
|
+
|
10
|
+
bundle check --path=${BUNDLE_CACHE} || bundle update
|
11
|
+
bundle clean
|
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path("../lib", __FILE__)
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require "gitlab_awesome_release/version"
|
5
4
|
|
@@ -14,23 +13,24 @@ Gem::Specification.new do |spec|
|
|
14
13
|
spec.homepage = "https://gitlab.com/sue445/gitlab_awesome_release"
|
15
14
|
spec.license = "MIT"
|
16
15
|
|
17
|
-
spec.files = `git ls-files -z`.split("\x0").reject {
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/}) }
|
18
17
|
spec.bindir = "exe"
|
19
|
-
spec.executables = spec.files.grep(%r{^exe/}) {
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f) }
|
20
19
|
spec.require_paths = ["lib"]
|
21
20
|
|
22
21
|
spec.required_ruby_version = ">= 2.1.0"
|
23
22
|
|
24
23
|
spec.add_dependency "dotenv"
|
25
|
-
spec.add_dependency "gitlab"
|
24
|
+
spec.add_dependency "gitlab", ">= 4.0.0"
|
26
25
|
spec.add_dependency "thor"
|
27
26
|
|
28
|
-
spec.add_development_dependency "bundler", "
|
29
|
-
spec.add_development_dependency "onkcop", "0.
|
27
|
+
spec.add_development_dependency "bundler", ">= 1.10"
|
28
|
+
spec.add_development_dependency "onkcop", "0.53.0.2"
|
30
29
|
spec.add_development_dependency "pry-byebug"
|
31
30
|
spec.add_development_dependency "rake", "~> 10.0"
|
32
31
|
spec.add_development_dependency "rspec"
|
33
32
|
spec.add_development_dependency "rspec-temp_dir"
|
33
|
+
spec.add_development_dependency "rubocop", "0.57.2" # rubocop v0.58.0+ requires ruby 2.2+
|
34
34
|
spec.add_development_dependency "simplecov"
|
35
35
|
spec.add_development_dependency "webmock"
|
36
36
|
spec.add_development_dependency "yard"
|
@@ -7,9 +7,9 @@ module GitlabAwesomeRelease
|
|
7
7
|
|
8
8
|
class CLI < Thor
|
9
9
|
DEFAULT_VERSION_FORMAT = "^v?[\\d.]+".freeze
|
10
|
-
GITLAB_ENV_FILES = %w
|
10
|
+
GITLAB_ENV_FILES = %w[.env.gitlab ~/.env.gitlab].freeze
|
11
11
|
|
12
|
-
GITLAB_API_DESCRIPTION = "GitLab API endpoint (e.g. http://example.com/api/
|
12
|
+
GITLAB_API_DESCRIPTION = "GitLab API endpoint (e.g. http://example.com/api/v4)".freeze
|
13
13
|
GITLAB_API_PRIVATE_TOKEN_DESCRIPTION = "Your private token".freeze
|
14
14
|
GITLAB_API_PROJECT_NAME = "Target project (e.g. group/repo_name)".freeze
|
15
15
|
LOG_LEVEL_DESCRIPTION = "Log level (debug|info|warn|error|fatal|unknown)".freeze
|
@@ -118,7 +118,7 @@ module GitlabAwesomeRelease
|
|
118
118
|
|
119
119
|
@logger = Logger.new(STDOUT)
|
120
120
|
@logger.level = logger_level(option_or_env(:log_level))
|
121
|
-
@logger.formatter = proc {
|
121
|
+
@logger.formatter = proc {|severity, datetime, _progname, message|
|
122
122
|
"[#{datetime}] #{severity} #{message}\n"
|
123
123
|
}
|
124
124
|
|
@@ -128,7 +128,7 @@ module GitlabAwesomeRelease
|
|
128
128
|
private_token: gitlab_api_private_token,
|
129
129
|
project_name: gitlab_project_name,
|
130
130
|
allow_tag_format: /#{allow_tag_format}/,
|
131
|
-
logger: @logger
|
131
|
+
logger: @logger,
|
132
132
|
)
|
133
133
|
end
|
134
134
|
|
@@ -10,7 +10,7 @@ module GitlabAwesomeRelease
|
|
10
10
|
end_time = Time.now
|
11
11
|
|
12
12
|
# NOTE: options[:headers] contains PRIVATE-TOKEN
|
13
|
-
_options = options.reject {
|
13
|
+
_options = options.reject {|k, _v| k == :headers }
|
14
14
|
self.class.logger.debug "(#{end_time - start_time} sec) #{method.upcase} #{path} #{_options}"
|
15
15
|
end
|
16
16
|
end
|
@@ -22,7 +22,7 @@ module GitlabAwesomeRelease
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def web_url
|
25
|
-
@web_url ||= Gitlab.project(
|
25
|
+
@web_url ||= Gitlab.project(@project_name).web_url
|
26
26
|
end
|
27
27
|
|
28
28
|
# all tag names order by author date
|
@@ -33,14 +33,18 @@ module GitlabAwesomeRelease
|
|
33
33
|
@logger.info "fetch git tags"
|
34
34
|
repo_tags =
|
35
35
|
with_paging do |params|
|
36
|
-
Gitlab.repo_tags(
|
36
|
+
Gitlab.repo_tags(@project_name, params)
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
|
+
# rubocop:disable Style/SymbolProc avoid SEGV on ruby 2.6.0
|
40
|
+
# https://bugs.ruby-lang.org/issues/15489
|
41
|
+
@all_tag_names = repo_tags.sort_by {|tag| tag.commit.authored_date }.map {|tag| tag.name }
|
42
|
+
# rubocop:enable Style/SymbolProc
|
39
43
|
end
|
40
44
|
|
41
45
|
# @return [Array<String>]
|
42
46
|
def release_tag_names
|
43
|
-
all_tag_names.find_all {
|
47
|
+
all_tag_names.find_all {|tag| tag =~ @allow_tag_format }
|
44
48
|
end
|
45
49
|
|
46
50
|
# @param oldest_tag [String]
|
@@ -96,11 +100,11 @@ module GitlabAwesomeRelease
|
|
96
100
|
# @param to [String]
|
97
101
|
# @return [Array<Integer>] MergeRequest iids
|
98
102
|
def merge_request_iids_between(from, to)
|
99
|
-
commits = Gitlab.repo_compare(
|
103
|
+
commits = Gitlab.repo_compare(@project_name, from, to).commits
|
100
104
|
|
101
105
|
merge_request_iids =
|
102
106
|
commits.map do |commit|
|
103
|
-
commit["message"] =~ /^Merge branch .*See merge request
|
107
|
+
commit["message"] =~ /^Merge branch .*See merge request .*\!(\d+)$/m
|
104
108
|
Regexp.last_match(1)
|
105
109
|
end
|
106
110
|
|
@@ -119,24 +123,29 @@ module GitlabAwesomeRelease
|
|
119
123
|
|
120
124
|
# find MergeRequest with iid
|
121
125
|
def merge_request(iid)
|
122
|
-
|
123
|
-
assert_merge_request_iid(mr, iid) if mr
|
124
|
-
mr
|
126
|
+
Gitlab.merge_request(@project_name, iid)
|
125
127
|
end
|
126
128
|
|
127
129
|
def add_merge_request_label(mr, label)
|
128
130
|
labels = mr.labels
|
129
131
|
labels << label
|
130
132
|
|
131
|
-
Gitlab.update_merge_request(
|
133
|
+
Gitlab.update_merge_request(@project_name, mr.iid, labels: labels.uniq.join(","))
|
132
134
|
@logger.info "Add [#{label}] to !#{mr.iid} #{mr.title}"
|
133
135
|
end
|
134
136
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
137
|
+
def merge_requests_summary_between(from, to)
|
138
|
+
mr_iids = merge_request_iids_between(from, to)
|
139
|
+
mr_iids.each_with_object("") do |iid, str|
|
140
|
+
begin
|
141
|
+
str << merge_request_summary(iid) + "\n"
|
142
|
+
rescue Gitlab::Error::NotFound # rubocop:disable Lint/HandleExceptions
|
143
|
+
# NOTE: suppress error (e.g. other repo's iid)
|
144
|
+
end
|
139
145
|
end
|
146
|
+
end
|
147
|
+
|
148
|
+
private
|
140
149
|
|
141
150
|
# @yield [params] paging block
|
142
151
|
# @yieldparam params [Hash] paging params for GitLab API (page: current page, per_page)
|
@@ -151,17 +160,5 @@ module GitlabAwesomeRelease
|
|
151
160
|
page += 1
|
152
161
|
end
|
153
162
|
end
|
154
|
-
|
155
|
-
def merge_requests_summary_between(from, to)
|
156
|
-
mr_iids = merge_request_iids_between(from, to)
|
157
|
-
mr_iids.each_with_object("") do |iid, str|
|
158
|
-
str << merge_request_summary(iid) + "\n"
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
def assert_merge_request_iid(mr, iid)
|
163
|
-
# NOTE: MR is found, but server is old GitLab?
|
164
|
-
raise "MergeRequest iid does not match (expected #{iid}, but #{mr.iid})" unless iid == mr.iid
|
165
|
-
end
|
166
163
|
end
|
167
164
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab_awesome_release
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sue445
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 4.0.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: 4.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: thor
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,14 +56,14 @@ dependencies:
|
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.10'
|
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
68
|
version: '1.10'
|
69
69
|
- !ruby/object:Gem::Dependency
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.53.0.2
|
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: 0.
|
82
|
+
version: 0.53.0.2
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: pry-byebug
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - '='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.57.2
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - '='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.57.2
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: simplecov
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -200,8 +214,8 @@ files:
|
|
200
214
|
- bin/console
|
201
215
|
- bin/setup
|
202
216
|
- exe/gitlab_awesome_release
|
217
|
+
- gitlab-ci/config
|
203
218
|
- gitlab-ci/rspec.sh
|
204
|
-
- gitlab-ci/rubocop.sh
|
205
219
|
- gitlab-ci/setup.sh
|
206
220
|
- gitlab_awesome_release.gemspec
|
207
221
|
- img/private_token.png
|
@@ -215,7 +229,7 @@ homepage: https://gitlab.com/sue445/gitlab_awesome_release
|
|
215
229
|
licenses:
|
216
230
|
- MIT
|
217
231
|
metadata: {}
|
218
|
-
post_install_message:
|
232
|
+
post_install_message:
|
219
233
|
rdoc_options: []
|
220
234
|
require_paths:
|
221
235
|
- lib
|
@@ -230,9 +244,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
230
244
|
- !ruby/object:Gem::Version
|
231
245
|
version: '0'
|
232
246
|
requirements: []
|
233
|
-
|
234
|
-
|
235
|
-
signing_key:
|
247
|
+
rubygems_version: 3.1.4
|
248
|
+
signing_key:
|
236
249
|
specification_version: 4
|
237
250
|
summary: Generate changelog from tags and MergeRequests on GitLab
|
238
251
|
test_files: []
|
data/gitlab-ci/rubocop.sh
DELETED