Merge pull request #5002 from heliclei/develop

support [ci skip] in commit message
This commit is contained in:
James Chen 2014-01-08 20:53:19 -08:00
commit b454bf01e3
2 changed files with 13 additions and 3 deletions

View File

@ -19,7 +19,7 @@ r = requests.get(api_get_pr)
pr = r.json()
#forge a payload
payload = {"action":"open","number":"","pull_request":""}
payload = {"action":"opened","number":"","pull_request":""}
payload['number']=pr_num
payload['pull_request']=pr

View File

@ -38,9 +38,8 @@ def main():
action = payload['action']
print 'action: ' + action
pr = payload['pull_request']
url = pr['html_url']
print "url:" + url
pr_desc = '<h3><a href='+ url + '> pr#' + str(pr_num) + ' is '+ action +'</a></h3>'
@ -61,7 +60,18 @@ def main():
if((action != 'opened') and (action != 'synchronize')):
print 'pull request #' + str(pr_num) + ' is '+action+', no build triggered'
return(0)
r = requests.get(pr['url']+"/commits")
commits = r.json()
last_commit = commits[len(commits)-1]
message = last_commit['commit']['message']
pattern = re.compile("\[ci(\s+)skip\]", re.I)
result = pattern.search(message)
if result is not None:
print 'skip build for pull request #' + str(pr_num)
return(0)
data = {"state":"pending", "target_url":target_url}
access_token = os.environ['GITHUB_ACCESS_TOKEN']
Headers = {"Authorization":"token " + access_token}