Skip to content

Commit

Permalink
chore: only publish revapi report if the PR is edited or opened. (#1161)
Browse files Browse the repository at this point in the history
  • Loading branch information
surli authored and monperrus committed Feb 2, 2017
1 parent ce2856d commit 3c03c32
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions chore/revapy.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from github import *

revapi_file = "./target/revapi_report.md"
accepted_actions = ["opened", "synchronize"]

args = sys.argv

Expand Down Expand Up @@ -57,13 +58,18 @@ def usage():
payloadJSON = json.loads(payload_string)
repo_name = payloadJSON['repository']['full_name']
pr_id = payloadJSON['pull_request']['number']

try:
repo = gh.get_repo(repo_name,True)

pr = repo.get_pull(pr_id)
pr.create_issue_comment(file_content)
except GithubException as e:
print "Error while creating the PR comment."
print e
exit(1)
action = payloadJSON['action']

if (action in accepted_actions):
try:
repo = gh.get_repo(repo_name,True)

pr = repo.get_pull(pr_id)
pr.create_issue_comment(file_content)
except GithubException as e:
print "Error while creating the PR comment."
print e
exit(1)
else:
print "Call action: "+action
exit(0)

0 comments on commit 3c03c32

Please sign in to comment.