lib/tutter/action/sppuppet.rb in tutter-sppuppet-0.0.6 vs lib/tutter/action/sppuppet.rb in tutter-sppuppet-0.0.7
- old
+ new
@@ -14,11 +14,11 @@
end
def run
# If a new pull request is opened, comment with instructions
if @data['action'] == 'opened' && @settings['post_instructions']
- issue = @data['issue']['number']
+ issue = @data['number']
comment = @settings['instructions'] || "To merge at least #{@settings['plus_ones_required']} person other than the submitter needs to write a comment with saying _+1_ or _:+1:_. Then write _!merge_ to trigger the merging."
begin
@client.add_comment(@project, issue, comment)
return 200, "Commented!"
rescue Octokit::NotFound
@@ -26,9 +26,14 @@
rescue Octokit::Unauthorized
return 401, "Authorization to #{@project} failed, please verify your access token"
rescue Octokit::TooManyLoginAttempts
return 429, "Account for #{@project} has been temporary locked down due to to many failed login attempts"
end
+ end
+
+ if @data['action'] != 'created'
+ # Not a new comment, ignore
+ return 200, 'not a new comment, skipping'
end
pull_request_id = @data['issue']['number']
pr = @client.pull_request @project, pull_request_id
plus_one = {}