@@ -18,7 +18,14 @@ class ForwardMerge
18
18
end
19
19
20
20
def find_forward_merges ( message_file )
21
+
21
22
$log. debug "Searching for forward merge"
23
+ branch = `git rev-parse -q --abbrev-ref HEAD` . strip
24
+ $log. debug "Found #{ branch } from git rev-parse --abbrev-ref"
25
+ if ( branch == "docs-build" ) then
26
+ $log. debug "Skipping docs build"
27
+ return nil
28
+ end
22
29
rev = `git rev-parse -q --verify MERGE_HEAD` . strip
23
30
$log. debug "Found #{ rev } from git rev-parse"
24
31
return nil unless rev
@@ -65,7 +72,7 @@ def find_milestone(username, password, repository, title)
65
72
prefix = title . delete_suffix ( '.x' )
66
73
$log. debug "Finding nearest milestone from candidates starting with #{ prefix } "
67
74
titles = milestones . map { |milestone | milestone [ 'title' ] }
68
- titles = titles . select { |title | title . start_with? ( prefix ) unless title . end_with? ( '.x' ) }
75
+ titles = titles . select { |title | title . start_with? ( prefix ) unless title . end_with? ( '.x' ) || ( title . count ( '.' ) > 2 ) }
69
76
titles = titles . sort_by { |v | Gem ::Version . new ( v ) }
70
77
$log. debug "Considering candidates #{ titles } "
71
78
if ( titles . empty? )
@@ -112,12 +119,16 @@ message_file=ARGV[0]
112
119
forward_merges = find_forward_merges ( message_file )
113
120
exit 0 unless forward_merges
114
121
115
- $log. debug "Loading config from ~/.spring-restdocs/forward_merge .yml"
122
+ $log. debug "Loading config from ~/.spring-restdocs/forward-merge .yml"
116
123
config = YAML . load_file ( File . join ( Dir . home , '.spring-restdocs' , 'forward-merge.yml' ) )
117
124
username = config [ 'github' ] [ 'credentials' ] [ 'username' ]
118
125
password = config [ 'github' ] [ 'credentials' ] [ 'password' ]
119
126
dry_run = config [ 'dry_run' ]
120
- repository = 'spring-projects/spring-restdocs'
127
+
128
+ gradleProperties = IO . read ( 'gradle.properties' )
129
+ springBuildType = gradleProperties . match ( /^spring\. build-type\s ?=\s ?(.*)$/ )
130
+ repository = ( springBuildType && springBuildType [ 1 ] != 'oss' ) ? "spring-projects/spring-restdocs-#{ springBuildType [ 1 ] } " : "spring-projects/spring-restdocs" ;
131
+ $log. debug "Targeting repository #{ repository } "
121
132
122
133
forward_merges . each do |forward_merge |
123
134
existing_issue = get_issue ( username , password , repository , forward_merge . issue )
0 commit comments