Skip to content

Commit bcf5ba9

Browse files
authored
get default_branch from @payload, use that for the Git.pull
fixes github-developer#23
1 parent aa77aa8 commit bcf5ba9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

server.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ def take_requested_action
222222
full_repo_name = @payload['repository']['full_name']
223223
repository = @payload['repository']['name']
224224
head_branch = @payload['check_run']['check_suite']['head_branch']
225+
default_branch = @payload['repository']['default_branch']
225226

226227
if (@payload['requested_action']['identifier'] == 'fix_rubocop_notices')
227228
clone_repository(full_repo_name, repository, head_branch)
@@ -257,7 +258,7 @@ def clone_repository(full_repo_name, repository, ref)
257258
@git = Git.clone("https://x-access-token:#{@installation_token.to_s}@github.com/#{full_repo_name}.git", repository)
258259
pwd = Dir.getwd()
259260
Dir.chdir(repository)
260-
@git.pull
261+
@git.pull("https://x-access-token:#{@installation_token.to_s}@github.com/#{full_repo_name}.git", branch=default_branch)
261262
@git.checkout(ref)
262263
Dir.chdir(pwd)
263264
end

0 commit comments

Comments
 (0)