@@ -203,7 +203,7 @@ namespace :git do
203
203
sh "git add ."
204
204
sh "git ci -m 'Update version to #{ version } '"
205
205
end
206
- force_update ( branch , nil )
206
+ force_update ( branch , nil , false )
207
207
end
208
208
209
209
{ :show => nil , :status => nil , :reset => '--hard' , :diff => nil } . each do |command , options |
@@ -387,9 +387,9 @@ namespace :ci do
387
387
end
388
388
389
389
desc "Updates the CI files and creates a PR"
390
- task :create_pr_with_updates , :custom_pr_comment do |t , args |
390
+ task :create_pr_with_updates , :custom_pr_comment , :force do |t , args |
391
391
opts = { except : %w[ rspec-rails ] }
392
- force_update ( update_ci_files_in_repos ( opts ) , args [ :custom_pr_comment ] , opts )
392
+ force_update ( update_ci_files_in_repos ( opts ) , args [ :custom_pr_comment ] , args [ :force ] == "force" , opts )
393
393
end
394
394
end
395
395
@@ -466,8 +466,8 @@ namespace :common_plaintext_files do
466
466
end
467
467
468
468
desc "Updates the common plaintext files files and creates a PR"
469
- task :create_pr_with_updates , :custom_pr_comment do |_t , args |
470
- force_update ( update_common_plaintext_files_in_repos , args [ :custom_pr_comment ] )
469
+ task :create_pr_with_updates , :custom_pr_comment , :force do |_t , args |
470
+ force_update ( update_common_plaintext_files_in_repos , args [ :custom_pr_comment ] , args [ :force ] == "force" )
471
471
end
472
472
end
473
473
@@ -558,12 +558,16 @@ def each_project_with_common_build(opts={}, &b)
558
558
each_project ( :except => except , &b )
559
559
end
560
560
561
- def force_update ( branch , custom_pr_comment , opts = { } )
561
+ def force_update ( branch , custom_pr_comment , skip_confirmation = false , opts = { } )
562
562
each_project_with_common_build ( opts ) do |name |
563
563
unless system ( "git push origin #{ branch } " )
564
- puts "Push failed, force? (y/n)"
565
- if STDIN . gets . downcase =~ /^y/
566
- sh "git push origin +#{ branch } "
564
+ if skip_confirmation
565
+ sh "git push origin #{ branch } --force-with-lease"
566
+ else
567
+ puts "Push failed, force? (y/n)"
568
+ if STDIN . gets . downcase =~ /^y/
569
+ sh "git push origin +#{ branch } "
570
+ end
567
571
end
568
572
create_pull_request ( name , branch , custom_pr_comment ) rescue nil
569
573
else
0 commit comments