Skip to content

Commit

Permalink
Marketplace for MLPro extensions #413
Browse files Browse the repository at this point in the history
  • Loading branch information
detlefarend committed Sep 13, 2023
1 parent 52eb7eb commit 4c126a6
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 11 deletions.
19 changes: 19 additions & 0 deletions marketplace/templates/issue_body
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
A new extension for MLPro has been detected. Please check for plausibility and add the repo to the whitelist or blacklist of the marketplace.

| | |
|-|-|
|**Title**|{title}|
|**URL**|{url}|
|**Version**|{version}|
|**Topics**|{topics}|
|**Description**|{desc}|


**Checklist:**
- [ ] **Plausibility check**
- [ ] Repo is no malware (mass generated pseudo-repo, dummy without senseful content, spam, ...)
- [ ] Repo has a concrete relation to MLPro
- [ ] Repo fulfills minimum quality requirements (documenation, sample files, ...)
- [ ] **Repo has been whitelisted**
- [ ] **Repo has been blacklisted**
- [ ] The reasons for this decision were commented in this issue
File renamed without changes.
Empty file.
39 changes: 28 additions & 11 deletions marketplace/update_marketplace.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import sys, os.path, time
from mlpro.bf.various import Log
from github import Auth, Github
from github import Auth, Github, Issue



Expand All @@ -30,16 +30,16 @@
## -------------------------------------------------------------------------------------------------
class Marketplace (Log):

C_TYPE = 'Marketplace'
C_NAME = 'MLPro'
C_TYPE = 'Marketplace'
C_NAME = 'MLPro'

C_FNAME_WHITELIST = 'whitelist'
C_FNAME_BLACKLIST = 'blacklist'
C_FNAME_DB = 'marketplace.csv'
C_FNAME_WHITELIST = 'whitelist'
C_FNAME_BLACKLIST = 'blacklist'
C_FNAME_TPL_ISSUE_BODY = 'templates' + os.sep + 'issue_body'

C_STATUS_APPROVED = 'Approved'
C_STATUS_DENIED = 'Denied'
C_STATUS_PENDING = 'Pending'
C_STATUS_APPROVED = 'Approved'
C_STATUS_DENIED = 'Denied'
C_STATUS_PENDING = 'Pending'

## -------------------------------------------------------------------------------------------------
def __init__(self, p_token, p_logging=Log.C_LOG_ALL):
Expand Down Expand Up @@ -122,6 +122,21 @@ def _get_extensions(self):
return extensions


## -------------------------------------------------------------------------------------------------
def _create_issue_body(self, p_extension) -> str:

topics = ', '.join(p_extension[8])
with open( sys.path[0] + os.sep + self.C_FNAME_TPL_ISSUE_BODY ) as f:
body = f.read().format( vars='variables', url=p_extension[6], title=p_extension[1], topics=topics, version=p_extension[3], desc=p_extension[2] )

return body


## -------------------------------------------------------------------------------------------------
def _create_issue_comment(self, p_extension) -> str:
return '@detlefarend Pseudo-comment...'


## -------------------------------------------------------------------------------------------------
def _create_issue(self, p_extension):

Expand Down Expand Up @@ -173,8 +188,10 @@ def _create_issue(self, p_extension):
# 2.1 Issue needs to be created
issue = self._mlpro.create_issue( title = issue_title,
labels = [ 'pending-extension'],
assignees = self._mlpro_admins,
body = 'A new extension for MLPro has been detected. Please check for seriousness and add the repo to the whitelist or blacklist of the marketplace.\n\n**Title:** [{title}]({url})\n**Version:** {version}\n**Description:** {desc}\n\n**Checklist:**\n- [ ] Check for seriousness is done\n- [ ] Repo has been whitelisted\n- [ ] Repo has been blacklisted\n - [ ] MLPro admins were informed\n - [ ] Repo owners were informed'.format(vars='variables', url=p_extension[6], title=p_extension[1], version=p_extension[3], desc=p_extension[2]) )
assignees = [ 'detlefarend' ], #self._mlpro_admins,
body = self._create_issue_body(p_extension) )

issue.create_comment(self._create_issue_comment(p_extension))

self.log(Log.C_LOG_TYPE_I, 'New issue created:', issue.number)

Expand Down

0 comments on commit 4c126a6

Please sign in to comment.