micro-editor / plugin-channel

Official plugin channel for micro
226 stars 49 forks source link

Automate adding plugins to the channel #82

Closed gamemaker1 closed 2 years ago

gamemaker1 commented 2 years ago

Hi @zyedidia,

Thanks a ton for creating and maintaining Micro - it is an amazing project, and I use the editor for everything to do with, well... editing :D

I noticed that there are a lot of PRs for adding a plugin piling up - and I decided to help out by attempting to automate the process:

What this PR does

This PR makes the process of adding plugins to the channel automatic. It runs a script every 24 hours (via GitHub actions) that:

  1. uses the Github search API to search for repositories with the micro-editor-plugin tag.
  2. for each repo retrieved, it searches for a repo.json file in the root of the repository.
  3. if found, it parses the repo.json file.
  4. it then adds the plugin to the table in the plugins.md file.
  5. it also adds the URL to the repo.json file to the channel.json file.

Caveats

A couple of issues:

1. Github-API dependent

This script only queries the GitHub API. So projects on Gitlab, Gitea, etc. cannot be added.

2. Cannot add plugins manually

This script overrides the current channel.json file every time it runs. This is so that we do not need to worry about repo/plugin renames, deletions and modifications to metadata. The downside is that if the repo owner does not add the micro-editor-plugin tag, the plugin will not be listed. Also, if the repo is not on GitHub, the plugin will not be listed.


I am working on a solution for the second caveat - so we can add plugins even if they are not on GitHub, or if the owner cannot add the micro-editor-plugin tag.

zyedidia commented 2 years ago

This is interesting. However, I worry about security issues if we add any plugin to the repo. We don't want any malicious plugins, and it is hard/impossible to automatically determine if a plugin is malicious. Perhaps this could be used as a tool for users to discover plugins on GitHub, although perhaps we should just recommend that plugin authors use the micro-editor-plugin github tag for discoverability.

At the moment I think the plugin channel serves two uses:

This approach might be useful for automating the second usecase, and then users themselves determine if they want to manually install plugins from github. Perhaps there could be a tool/command integrated into micro (or separately) that searches github for plugins with a repo.json and a micro-editor-plugin tag. It could additionally search according to some keywords that the user gives, and return results with some sort of ranking (stars/downloads/commits, something like that).

gamemaker1 commented 2 years ago

We don't want any malicious plugins, and it is hard/impossible to automatically determine if a plugin is malicious

Good point.

Perhaps there could be a tool/command integrated into micro (or separately) that searches github for plugins with a repo.json and a micro-editor-plugin tag. It could additionally search according to some keywords that the user gives, and return results with some sort of ranking (stars/downloads/commits, something like that).

I really like this idea - making something like a 'search engine' for micro plugins. Maybe I could give that a try.


Thanks again for your amazing work on Micro!