Skip to content
This repository has been archived by the owner on Apr 15, 2020. It is now read-only.

Commit

Permalink
Cleanup ci retry handling
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed May 22, 2017
1 parent 30b298c commit 1989267
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions badwolf/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def trigger_slack_webhook(webhooks, context):
),
'short': True,
})
else:
elif context['context'].type != 'commit':
fields.append({
'title': 'Branch',
'value': '<https://bitbucket.org/{repo}/src?at={branch}|{branch}>'.format(
Expand All @@ -311,7 +311,7 @@ def trigger_slack_webhook(webhooks, context):
),
'short': True,
})
if context['context'].type in {'branch', 'tag'}:
if context['context'].type in {'branch', 'tag', 'commit'}:
fields.append({
'title': 'Commit',
'value': '<https://bitbucket.org/{repo}/commits/{sha}|{sha}>'.format(
Expand Down
14 changes: 7 additions & 7 deletions badwolf/webhook/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ def handle_pull_request_approved(payload):
repo = payload['repository']
pr = payload['pullrequest']
pr_id = pr['id']
title = pr['title']
description = pr['description'] or ''
title = pr['title'].lower()
description = (pr['description'] or '').lower()

for keyword in ('wip', 'merge skip', 'working in progress'):
if keyword in title.lower() or keyword in description.lower():
if keyword in title or keyword in description:
logger.info('%s found, ignore auto merge.', keyword)
return

Expand Down Expand Up @@ -206,9 +206,9 @@ def handle_pull_request_approved(payload):
'badwolf/test',
url_for('log.build_log', sha=commit_hash, _external=True)
)
message = 'Auto merge pull request #{}: {}'.format(pr_id, title)
message = 'Auto merge pull request #{}: {}'.format(pr_id, pr['title'])
if description:
message += '\n{}'.format(description)
message += '\n{}'.format(pr['description'])
try:
status = build_status.get()
if status['state'] == 'SUCCESSFUL':
Expand All @@ -221,7 +221,7 @@ def handle_pull_request_approved(payload):
@register_event_handler('repo:commit_comment_created')
def handle_repo_commit_comment(payload):
comment = payload['comment']
comment_content = comment['content']['raw']
comment_content = comment['content']['raw'].lower()

retry = 'ci retry' in comment_content
rebuild = 'ci rebuild' in comment_content
Expand All @@ -236,7 +236,7 @@ def handle_repo_commit_comment(payload):
context = Context(
repo_name,
payload['actor'],
'commit',
'commit', # set to commit for ci retry on commit
payload['commit']['message'],
{
'repository': {'full_name': repo_name},
Expand Down

0 comments on commit 1989267

Please sign in to comment.