Exemplo n.º 1
0
    def _buildCommitCommentedMessage(self):
        """
        Build message content, corresponding to github "Commit commented" event.
        To: @username (API does not return commit author, maybe need additional request).
        :return: Object of class ChatworkMessage
        """
        message = cwmessage.ChatworkMessage()
        message.setAddresseeList(self._buildAddresseeList([], self._payload['comment']['body']))
        message.setTitle('Commit Commented by ' + self._getChatworkUsericonByGithubName(self._payload['sender']['login']) + '\n' + \
            self._payload['comment']['html_url'])
        message.setBody(self._payload['comment']['body'])

        return message
Exemplo n.º 2
0
    def _buildPROpenedMessage(self):
        """
        Build message content, corresponding to github "PR opened" event.
        To @username.
        :return: Object of class ChatworkMessage
        """
        message = cwmessage.ChatworkMessage()
        message.setAddresseeList(self._buildAddresseeList([], self._payload['pull_request']['body']))
        message.setTitle('PR Opened by ' + self._getChatworkUsericonByGithubName(self._payload['sender']['login']) + '\n' + \
            self._payload['pull_request']['html_url'])
        message.setBody(self._payload['pull_request']['title'] + '\n\n' + \
            self._payload['pull_request']['body'])

        return message
Exemplo n.º 3
0
    def _buildPRAssignedMessage(self):
        """
        Build message content, corresponding to github "Issue assigned" event.
        To: issue assignee.
        :return: Object of class ChatworkMessage
        """
        to_list = [self._payload['assignee']['login']]

        message = cwmessage.ChatworkMessage()
        message.setAddresseeList(self._buildAddresseeList(to_list))
        message.setTitle('PR Assigned to ' + self._getChatworkUsericonByGithubName(self._payload['assignee']['login']) + \
            ' by ' + self._getChatworkUsericonByGithubName(self._payload['sender']['login']) + '\n' + \
            self._payload['pull_request']['html_url'])
        message.setBody(self._payload['pull_request']['title'])

        return message
Exemplo n.º 4
0
    def _buildPRClosedMessage(self):
        """
        Build message content, corresponding to github "PR closed" event.
        To: pull request author and assignees.
        :return: Object of class ChatworkMessage
        """
        to_list = [self._payload['pull_request']['user']['login']]

        for assignee in self._payload['pull_request']['assignees']:
            if assignee['login'] != self._payload['pull_request']['user']['login']:
                to_list.append(assignee['login'])

        message = cwmessage.ChatworkMessage()
        message.setAddresseeList(self._buildAddresseeList(to_list))
        message.setTitle('PR Closed by ' + self._getChatworkUsericonByGithubName(self._payload['sender']['login']) + '\n' + \
            self._payload['pull_request']['html_url'])
        message.setBody(self._payload['pull_request']['title'])

        return message
Exemplo n.º 5
0
    def _buildIssueClosedMessage(self):
        """
        Build message content, corresponding to github "Issue closed" event.
        To: issue assignees and issue author and @username in body.
        :return: Object of class ChatworkMessage
        """
        to_list = [self._payload['issue']['user']['login']]

        for assignee in self._payload['issue']['assignees']:
            if assignee['login'] != self._payload['issue']['user']['login']:
                to_list.append(assignee['login'])

        message = cwmessage.ChatworkMessage()
        message.setAddresseeList(self._buildAddresseeList(to_list, self._payload['issue']['body']))
        message.setTitle('Issue Closed by ' + self._getChatworkUsericonByGithubName(self._payload['sender']['login']) + '\n' + \
            self._payload['issue']['html_url'])
        message.setBody(self._payload['issue']['title'])

        return message