mirror of
https://github.com/unsplash/comment-on-pr.git
synced 2024-11-10 17:12:39 +08:00
Find PRs with commit SHA
This commit is contained in:
parent
a7e92465c2
commit
ecc4109fd1
1 changed files with 3 additions and 3 deletions
|
@ -21,11 +21,11 @@ end
|
|||
repo = push["repository"]["full_name"]
|
||||
pulls = github.pull_requests(repo, state: "open")
|
||||
|
||||
branch_name = push["ref"].split("/").last
|
||||
pr = pulls.find { |pr| pr["head"]["ref"] == branch_name }
|
||||
push_head = push["after"]
|
||||
pr = pulls.find { |pr| pr["head"]["sha"] == push_head }
|
||||
|
||||
if !pr
|
||||
puts "Couldn't find an open pull request for branch #{branch_name}."
|
||||
puts "Couldn't find an open pull request for branch with head at #{push_head}."
|
||||
exit(1)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue