32
32
opts . on ( '-n' , '--target-path PATH' , 'Path of targeted file or dir' ) { |v | @options [ :target_path ] = v }
33
33
opts . on ( '--pr-title PR_TITLE' , 'Title of a PR' ) { |v | @options [ :pr_title ] = v }
34
34
opts . on ( '--pr-body PR_BODY' , 'Body of a PR' ) { |v | @options [ :pr_body ] = v }
35
- opts . on ( '--base-branch' , 'A new branch will be generated if not specified or the branch does not exist.' ) { |v | @options [ :base_branch ] = v }
36
- opts . on ( '--commit-comment' , 'Commit comment' ) { |v | @options [ :commit_comment ] = v }
35
+ opts . on ( '--base-branch BASE_BRANCH ' , 'A new branch will be generated if not specified or the branch does not exist.' ) { |v | @options [ :base_branch ] = v }
36
+ opts . on ( '--commit-comment COMMIT_COMMENT ' , 'Commit comment' ) { |v | @options [ :commit_comment ] = v }
37
37
end . parse!
38
38
39
39
raise OptionParser ::MissingArgument if @options [ :repo_token ] . nil? || @options [ :target_path ] . nil?
47
47
ACCESS_TOKEN = @options [ :repo_token ]
48
48
TARGET_PATH = @options [ :target_path ]
49
49
PR_TITLE = @options [ :pr_title ]
50
- PR_BODY = @options [ :pr_boday ]
50
+ PR_BODY = @options [ :pr_body ]
51
51
BASE_BRANCH = @options [ :base_branch ]
52
52
COMMIT_COMMENT = @options [ :commit_comment ]
53
53
54
54
def generate_pr_for_target_changes ( repo_root :, target_path :)
55
- system ( "cd #{ REPO_ROOT } \n git checkout -b #{ BASE_BRANCH } \n " )
56
55
if `git diff #{ TARGET_PATH } ` ==""
57
56
puts "The file, #{ TARGET_PATH } , has no changes."
58
57
return
59
58
end
60
- system ( "git add #{ TARGET_PATH } \n git commit -m \" #{ COMMIT_COMMENT } \" \n git push -u origin #{ BASE_BRANCH } " )
59
+ system ( "cd #{ REPO_ROOT } \n git checkout -b #{ BASE_BRANCH } \n git add #{ TARGET_PATH } \n git commit -m \" #{ COMMIT_COMMENT } \" \n git push -u origin #{ BASE_BRANCH } " )
61
60
client = Octokit ::Client . new ( access_token : ACCESS_TOKEN )
62
61
client . create_pull_request ( "firebase/firebase-ios-sdk" , "master" , BASE_BRANCH , PR_TITLE , PR_BODY )
63
62
end
@@ -68,4 +67,3 @@ def main()
68
67
end
69
68
70
69
main ( )
71
-
0 commit comments