changelogerator 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/changelogerator.rb +9 -12
- 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: b916cdb658f760af9794c4f947c54839f8b19b596b3a0fe9e20f674c8898f31d
|
4
|
+
data.tar.gz: efa45a9492704d76197ccb4b3d15d227a6c4a01d35bfe8fe6ff81b7b84049532
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 298138ad4d9d52615de65931e3a96d7b5aee928bc71732a7142dfe2b8d97008d0dc090c2ef9ce81060b375288e3c5d9a4a3a375dafbca0b056d4b0b525ddcdc7
|
7
|
+
data.tar.gz: 70897f7bf61f7721a9d7097479e7c39c4be18c1781d970908b0620aadb2bf106d31ba81d0bc8e0e0eed988e38e0fda49a7f6549c38d511d0f8dd5e48db2fc93f
|
data/lib/changelogerator.rb
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
# on how we classify the importance of PRs in the paritytech/polkadot project.
|
8
8
|
# Probably not tremendously useful to other projects.
|
9
9
|
class Changelog
|
10
|
-
require '
|
10
|
+
require 'octokit'
|
11
11
|
|
12
12
|
attr_accessor :changes
|
13
13
|
attr_reader :priority
|
@@ -65,14 +65,11 @@ class Changelog
|
|
65
65
|
# token: a Github personal access token
|
66
66
|
# prefix: whether or not to prefix PR numbers with their repo in the changelog
|
67
67
|
def initialize(github_repo, from, to, token: '', prefix: nil)
|
68
|
-
|
69
|
-
@ghr = github_repo
|
68
|
+
@repo = github_repo
|
70
69
|
@priorities = self.class.priorities
|
71
|
-
@gh =
|
72
|
-
|
73
|
-
|
74
|
-
c.repo = repo
|
75
|
-
end
|
70
|
+
@gh = Octokit::Client.new(
|
71
|
+
access_token: token
|
72
|
+
)
|
76
73
|
@changes = prs_from_ids(pr_ids_from_git_diff(from, to), prefix)
|
77
74
|
# add priority to each change
|
78
75
|
@changes.map { |c| apply_priority_to_change(c) }
|
@@ -92,8 +89,8 @@ class Changelog
|
|
92
89
|
end
|
93
90
|
|
94
91
|
def pr_ids_from_git_diff(from, to)
|
95
|
-
@gh.
|
96
|
-
title =
|
92
|
+
@gh.compare(@repo, from, to).commits.map do |c|
|
93
|
+
title = c.commit.message.split("\n\n").first
|
97
94
|
next unless title =~ /\(#[0-9]+\)$/
|
98
95
|
|
99
96
|
title.gsub(/.*#([0-9]+)\)$/, '\1')
|
@@ -103,9 +100,9 @@ class Changelog
|
|
103
100
|
def prs_from_ids(ids, prefix)
|
104
101
|
prs = []
|
105
102
|
ids.each do |pr|
|
106
|
-
pull = @gh.
|
103
|
+
pull = @gh.pull_request(@repo, pr)
|
107
104
|
pull[:pretty_title] = if prefix
|
108
|
-
"#{pull[:title]} (#{@
|
105
|
+
"#{pull[:title]} (#{@repo}##{pull[:number]})"
|
109
106
|
else
|
110
107
|
"#{pull[:title]} (##{pull[:number]})"
|
111
108
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: changelogerator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Pugh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: github_api
|