def create_issue_cmd(self, msg, match): """Create issues on GitHub and GitLab repositories.""" # Ignore QuotesBear, LineLengthBear, PyCodeStyleBear user = msg.frm.nick if not user: yield 'ERROR: The above command cannot be operated without nick.' return repo_name = match.group(1) iss_title = match.group(2) iss_description = match.group(3) if match.group(3) is not None else '' extra_msg = '\nOpened by @{username} at [{backend}]({msg_link})'.format( username=user, backend=self.bot_config.BACKEND, msg_link=message_link(self, msg) ) if repo_name in self.REPOS: repo = self.REPOS[repo_name] iss = repo.create_issue(iss_title, iss_description + extra_msg) yield 'Here you go: {}'.format(iss.web_url) else: yield tenv().get_template( 'labhub/errors/no-repository.jinja2.md' ).render( target=user, )
def create_issut_cmd(self, msg, match): """Create issues on GitHub and GitLab repositories.""" # Ignore QuotesBear, LineLengthBear, PyCodeStyleBear repo_name = match.group(1) iss_title = match.group(2) iss_description = match.group(3) if match.group(3) is not None else '' extra_msg = '\nOpened by @{username} at [{backend}]({msg_link})'.format( username=msg.frm.nick, backend=self.bot_config.BACKEND, msg_link=message_link(self, msg)) if repo_name in self.REPOS: repo = self.REPOS[repo_name] iss = repo.create_issue(iss_title, iss_description + extra_msg) return 'Here you go: {}'.format(iss.url) else: return ('Can\'t create an issue for a repository that does not ' 'exist. Please ensure that the repository is available ' 'and owned by the org.')