Пример #1
0
 def is_formatted_correctly(self) -> bool:
     title: str = self.get_title()
     is_valid: bool = False
     for issue_type in config_manager.issues()['types']:
         if title.startswith('(' + issue_type + ')'):
             is_valid = True
             break
 
     return is_valid and re.search(config_manager.issues()['title_format'], title) != None
Пример #2
0
async def unassigned(event: Event, github_object: GitHubAPI) -> None:
    """ endpoint for when an issue is unassigned """
    issue: Issue = Issue(event, github_object)

    comment: str = store.format_string(
        config_manager.issues()['on_unassigned_comment'])
    if comment != None:
        await issue.comment(comment)
Пример #3
0
async def opened(event: Event, github_object: GitHubAPI) -> None:
    """ endpoint for when an issue is opened """
    issue: Issue = Issue(event, github_object)

    # first check that the formatting is correct
    if not issue.is_formatted_correctly():
        await issue.comment(
            'title is formatted incorrectly. closing issue. please resubmit your issue in the correct format'
        )
        await issue.close()
        return

    # issue is formatted correctly post on opened comment
    comment: str = store.format_string(
        config_manager.issues()['on_opened_comment'])
    if comment != None:
        await issue.comment(comment)
Пример #4
0
 def is_registered_command(self, command: str) -> bool:
     for cli_command in config_manager.issues()['cli']:
         if store.format_string(cli_command['command']) == command:
             return True
     return False