@@ -18,7 +18,14 @@ class ForwardMerge
1818end
1919
2020def find_forward_merges ( message_file )
21+
2122 $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
2229 rev = `git rev-parse -q --verify MERGE_HEAD` . strip
2330 $log. debug "Found #{ rev } from git rev-parse"
2431 return nil unless rev
@@ -65,7 +72,7 @@ def find_milestone(username, password, repository, title)
6572 prefix = title . delete_suffix ( '.x' )
6673 $log. debug "Finding nearest milestone from candidates starting with #{ prefix } "
6774 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 ) }
6976 titles = titles . sort_by { |v | Gem ::Version . new ( v ) }
7077 $log. debug "Considering candidates #{ titles } "
7178 if ( titles . empty? )
@@ -112,12 +119,16 @@ message_file=ARGV[0]
112119forward_merges = find_forward_merges ( message_file )
113120exit 0 unless forward_merges
114121
115- $log. debug "Loading config from ~/.spring-restdocs/forward_merge .yml"
122+ $log. debug "Loading config from ~/.spring-restdocs/forward-merge .yml"
116123config = YAML . load_file ( File . join ( Dir . home , '.spring-restdocs' , 'forward-merge.yml' ) )
117124username = config [ 'github' ] [ 'credentials' ] [ 'username' ]
118125password = config [ 'github' ] [ 'credentials' ] [ 'password' ]
119126dry_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 } "
121132
122133forward_merges . each do |forward_merge |
123134 existing_issue = get_issue ( username , password , repository , forward_merge . issue )
0 commit comments