예제 #1
0
def open_issue(pr, pr_checks, hub_repo: Repository, module, jina_core_version):
    """opens an issue for the PR with the failed checks (if not already open)"""
    issue_name = f'{FIX_MODULE_TEMPLATE}{module}'
    existing_issue_for_pr = [
        i for i in list(hub_repo.get_issues(state='open'))
        if i.title == issue_name
    ]
    if len(existing_issue_for_pr) > 0:
        print(f'Found existing issue: {existing_issue_for_pr}')
        return existing_issue_for_pr[0]
    else:
        # open the issue
        body = f"""
**[This is an automated issue opened as part of the hub modules update GH action. DO NOT EDIT THIS DESCRIPTION]**

Could not build module {module} for Jina core version {jina_core_version} because some of the checks failed:

```
{[(c['name'], c['status'], c['conclusion']) for c in pr_checks]}
```

See {pr.html_url} for more info. {TAG_IN_ISSUES}
"""
        issue = hub_repo.create_issue(
            title=issue_name,
            body=body,
        )
        print(f'opened issue at {issue.html_url}')
        return issue
 def _create_or_update_issue(self, reposlug: str, repo: Repository,
                             label: Label, title: str, body: str) -> None:
     issue = self._find_issue(repo, label, title)
     if issue:
         issue.edit(body=body)
         if self._verbose:
             print(
                 "[I] Updated issue https://github.com/{}/issues/{}".format(
                     reposlug, issue.number))
     else:
         issue = repo.create_issue(title, body, labels=[label])
         if self._verbose:
             print(
                 "[I] Created issue https://github.com/{}/issues/{}".format(
                     reposlug, issue.number))
예제 #3
0
 def clone(self, base_repository: Repository, new_repository: Repository):
     # copy issues
     for issue in base_repository.get_issues(direction="asc"):
         new_repository.create_issue(issue.title, issue.body)