Merge pull request #3 from unsplash/feature/check-duplicates

Check for existing notification before commenting
This commit is contained in:
Aaron Klaassen 2019-09-30 13:40:48 -05:00 committed by GitHub
commit f2225490f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)