fastlane-plugin-ci_changelog 0.6.0 → 0.6.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1282307e44fff5f87df59f1ecd02151d45570a0d9607a1688873ee2e65ef99e
|
4
|
+
data.tar.gz: 3bc5f6a4bab39255aea3545b351711f22fee754958c3b62f2139535d7d6b63a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 511c98128befa5594c56d350955b520d3b2e2cc29b3a67324728ab66198a43313046b78caafe9af43a8a9a3283b84fb8b3e187a4feb90c6241f9b9fff69c26a8
|
7
|
+
data.tar.gz: efb0cf35c098c3959a3694e88156ee331ce57ace9a7887ff8427b4ce291980f9f2940bae5893222e8f84cc3e4b0840cdf26631a0efccf1201349efc742672d64
|
@@ -3,11 +3,6 @@ require 'json'
|
|
3
3
|
module Fastlane
|
4
4
|
module Helper
|
5
5
|
class CiChangelogHelper
|
6
|
-
def self.git_commits(last_success_commit)
|
7
|
-
git_logs = `git log --pretty="format:%s - %cn [%ci]" #{last_success_commit}..HEAD`.strip.gsub(' +0800', '')
|
8
|
-
git_logs.split("\n")
|
9
|
-
end
|
10
|
-
|
11
6
|
def self.dump_jenkins_commits(body, branch)
|
12
7
|
json = JSON.parse(body)
|
13
8
|
UI.verbose("- API Result: #{json['result']}")
|
@@ -35,8 +30,11 @@ module Fastlane
|
|
35
30
|
project_id = ENV['CI_PROJECT_ID']
|
36
31
|
from, to = fetch_gitlab_compare_commit(endpoint, private_token, project_id)
|
37
32
|
return [] unless from && to
|
38
|
-
|
39
|
-
|
33
|
+
if from == to
|
34
|
+
fetch_gitlab_single_commit(endpoint, private_token, project_id, from)
|
35
|
+
else
|
36
|
+
fetch_gitlab_commits(endpoint, private_token, project_id, from, to)
|
37
|
+
end
|
40
38
|
end
|
41
39
|
|
42
40
|
def self.fetch_gitlab_compare_commit(endpoint, private_token, project_id)
|
@@ -52,18 +50,22 @@ module Fastlane
|
|
52
50
|
.get(jobs_url)
|
53
51
|
|
54
52
|
jobs = res.parse.select { |job| job['name'] == job_name }
|
53
|
+
UI.verbose("Matched jobs #{job_name}: #{jobs.size}")
|
55
54
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
if to_commit.nil?
|
55
|
+
if jobs.size == 1
|
56
|
+
to_commit = from_commit = jobs[0]['pipeline']['sha']
|
57
|
+
else
|
58
|
+
jobs.each_with_index do |job, i|
|
59
|
+
commit = job['pipeline']['sha']
|
60
|
+
case job['status']
|
61
|
+
when 'running'
|
64
62
|
to_commit = commit
|
65
|
-
|
66
|
-
|
63
|
+
when 'success'
|
64
|
+
if to_commit.nil?
|
65
|
+
to_commit = commit
|
66
|
+
elsif to_commit && from_commit.nil?
|
67
|
+
from_commit = commit
|
68
|
+
end
|
67
69
|
end
|
68
70
|
end
|
69
71
|
end
|
@@ -86,6 +88,29 @@ module Fastlane
|
|
86
88
|
end
|
87
89
|
end
|
88
90
|
|
91
|
+
def self.fetch_gitlab_single_commit(endpoint, private_token, project_id, sha)
|
92
|
+
commit_url = "#{endpoint}/projects/#{project_id}/repository/commits/#{sha}"
|
93
|
+
UI.verbose("Fetching single commit url #{commit_url}")
|
94
|
+
res = HTTP.follow
|
95
|
+
.headers('PRIVATE-TOKEN' => private_token)
|
96
|
+
.get(commit_url)
|
97
|
+
|
98
|
+
commits = []
|
99
|
+
if res.code == 200
|
100
|
+
commit = res.parse
|
101
|
+
commits << {
|
102
|
+
id: commit['id'],
|
103
|
+
date: commit['created_at'],
|
104
|
+
title: commit['title'].strip,
|
105
|
+
message: commit['title'].strip,
|
106
|
+
author: commit['author_name'].strip,
|
107
|
+
email: commit['author_email'].strip
|
108
|
+
}
|
109
|
+
end
|
110
|
+
|
111
|
+
commits
|
112
|
+
end
|
113
|
+
|
89
114
|
def self.fetch_gitlab_commits(endpoint, private_token, project_id, from, to)
|
90
115
|
compare_url = "#{endpoint}/projects/#{project_id}/repository/compare"
|
91
116
|
params = {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-ci_changelog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- icyleaf
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|