mirror of
https://github.com/unsplash/comment-on-pr.git
synced 2024-09-20 07:36:02 +08:00
Merge pull request #3 from unsplash/feature/check-duplicates
Check for existing notification before commenting
This commit is contained in:
commit
f2225490f4
|
@ -30,4 +30,13 @@ if !pr
|
|||
end
|
||||
|
||||
message = ARGV.join(' ')
|
||||
|
||||
coms = github.issue_comments(repo, pr["number"])
|
||||
duplicate = coms.find { |c| c["user"]["login"] == "github-actions[bot]" && c["body"] == message }
|
||||
|
||||
if duplicate
|
||||
puts "The PR already contains a database change notification"
|
||||
exit(0)
|
||||
end
|
||||
|
||||
github.add_comment(repo, pr["number"], message)
|
||||
|
|
Loading…
Reference in a new issue