Skip to content

Commit

Permalink
Merge pull request #3640 from dependabot/github-create-ref-422
Browse files Browse the repository at this point in the history
GitHub PullRequestCreator: prepend refs/
  • Loading branch information
thepwagner committed May 5, 2021
2 parents 558d137 + 13b3ea1 commit 0e7f74d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions common/lib/dependabot/pull_request_creator/github.rb
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@ def create_or_update_branch(commit)
end

def create_branch(commit)
ref = "heads/#{branch_name}"
ref = "refs/heads/#{branch_name}"

begin
branch =
github_client_for_source.create_ref(source.repo, ref, commit.sha)
@branch_name = ref.gsub(%r{^heads/}, "")
@branch_name = ref.gsub(%r{^refs/heads/}, "")
branch
rescue Octokit::UnprocessableEntity => e
# Return quietly in the case of a race
Expand All @@ -244,7 +244,7 @@ def create_branch(commit)

# Branch creation will fail if a branch called `dependabot` already
# exists, since git won't be able to create a dir with the same name
ref = "heads/#{SecureRandom.hex[0..3] + branch_name}"
ref = "refs/heads/#{SecureRandom.hex[0..3] + branch_name}"
retry
end
end
Expand Down

0 comments on commit 0e7f74d

Please sign in to comment.