def get_page_build_body(payload: Dict[str, Any]) -> Text: build = payload['build'] action = build['status'] if action == 'null': action = u'has yet to be built' elif action == 'building': action = u'is being building' elif action == 'errored': action = u'is errored{}'.format( CONTENT_MESSAGE_TEMPLATE.format(message=build['error']['message'])) else: action = u'is {}'.format(action) return u"Github Pages build, trigerred by {}, {}".format( payload['build']['pusher']['login'], action)
def get_page_build_body(payload: Dict[str, Any]) -> str: build = payload['build'] status = build['status'] actions = { 'null': 'has yet to be built', 'building': 'is being built', 'errored': 'has failed{}', 'built': 'has finished building', } action = actions.get(status, 'is {}'.format(status)) action.format( CONTENT_MESSAGE_TEMPLATE.format(message=build['error']['message'])) return u"Github Pages build, trigerred by {}, {}.".format( payload['build']['pusher']['login'], action)
def get_page_build_body(payload: Dict[str, Any]) -> Text: build = payload['build'] action = build['status'] if action == 'null': action = u'has yet to be built' elif action == 'building': action = u'is being building' elif action == 'errored': action = u'is errored{}'.format( CONTENT_MESSAGE_TEMPLATE.format(message=build['error']['message']) ) else: action = u'is {}'.format(action) return u"Github Pages build, trigerred by {}, {}".format( payload['build']['pusher']['login'], action )
def get_page_build_body(payload: Dict[str, Any]) -> str: build = payload['build'] status = build['status'] actions = { 'null': 'has yet to be built', 'building': 'is being built', 'errored': 'has failed{}', 'built': 'has finished building', } action = actions.get(status, 'is {}'.format(status)) action.format( CONTENT_MESSAGE_TEMPLATE.format(message=build['error']['message']) ) return u"Github Pages build, trigerred by {}, {}".format( payload['build']['pusher']['login'], action )
def get_page_build_body(helper: Helper) -> str: payload = helper.payload build = payload["build"] status = build["status"] actions = { "null": "has yet to be built", "building": "is being built", "errored": "has failed{}", "built": "has finished building", } action = actions.get(status, f"is {status}") action.format( CONTENT_MESSAGE_TEMPLATE.format(message=build["error"]["message"]), ) return "GitHub Pages build, triggered by {}, {}.".format( payload["build"]["pusher"]["login"], action, )
def get_page_build_body(helper: Helper) -> str: payload = helper.payload build = payload['build'] status = build['status'] actions = { 'null': 'has yet to be built', 'building': 'is being built', 'errored': 'has failed{}', 'built': 'has finished building', } action = actions.get(status, f'is {status}') action.format( CONTENT_MESSAGE_TEMPLATE.format(message=build['error']['message']), ) return "Github Pages build, triggered by {}, {}.".format( payload['build']['pusher']['login'], action, )
def get_pr_opened_or_modified_body( payload: WildValue, action: str, include_title: Optional[str] ) -> str: pr = payload["pullRequest"] description = pr.get("description").tame(check_none_or(check_string)) assignees_string = get_assignees_string(pr) if assignees_string: # Then use the custom message template for this particular integration so that we can # specify the reviewers at the end of the message (but before the description/message). parameters = { "user_name": get_user_name(payload), "action": action, "url": pr["links"]["self"][0]["href"].tame(check_string), "number": pr["id"].tame(check_int), "source": pr["fromRef"]["displayId"].tame(check_string), "destination": pr["toRef"]["displayId"].tame(check_string), "message": description, "assignees": assignees_string, "title": pr["title"].tame(check_string) if include_title else None, } if include_title: body = PULL_REQUEST_OPENED_OR_MODIFIED_TEMPLATE_WITH_REVIEWERS_WITH_TITLE.format( **parameters, ) else: body = PULL_REQUEST_OPENED_OR_MODIFIED_TEMPLATE_WITH_REVIEWERS.format(**parameters) punctuation = ":" if description else "." body = f"{body}{punctuation}" if description: body += "\n" + CONTENT_MESSAGE_TEMPLATE.format(message=description) return body return get_pull_request_event_message( user_name=get_user_name(payload), action=action, url=pr["links"]["self"][0]["href"].tame(check_string), number=pr["id"].tame(check_int), target_branch=pr["fromRef"]["displayId"].tame(check_string), base_branch=pr["toRef"]["displayId"].tame(check_string), message=description, assignee=assignees_string if assignees_string else None, title=pr["title"].tame(check_string) if include_title else None, )