From 7fd0903d83d7366e2a326a13473e1a366fb37da7 Mon Sep 17 00:00:00 2001 From: uy/sun Date: Thu, 28 Nov 2024 10:52:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B1=95=E7=A4=BA=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E9=A1=B9=E5=B9=B6=E6=94=AF=E6=8C=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20(#28)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: show plugin config and support edit * feat: add issue template * fix: use URLSearchParams * refactor: only computed once Co-authored-by: StarHeart * ci: add noneflow --------- Co-authored-by: StarHeart --- .github/ISSUE_TEMPLATE/bug_report.yml | 36 +++++++++ .github/ISSUE_TEMPLATE/config.yml | 1 + .github/ISSUE_TEMPLATE/feature_request.yml | 20 +++++ .github/ISSUE_TEMPLATE/plugin_config_edit.yml | 33 ++++++++ .github/workflows/noneflow.yml | 75 +++++++++++++++++++ src/types/results.ts | 4 +- src/views/PluginPage.vue | 37 ++++++++- 7 files changed, 201 insertions(+), 5 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml create mode 100644 .github/ISSUE_TEMPLATE/plugin_config_edit.yml create mode 100644 .github/workflows/noneflow.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 00000000..cd93d8ee --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,36 @@ +name: Bug 反馈 +title: "bug: 出现异常" +description: 提交 Bug 反馈以帮助我们改进代码 +labels: ["bug"] +body: + - type: textarea + id: describe + attributes: + label: 描述问题 + description: 清晰简洁地说明问题是什么 + validations: + required: true + + - type: textarea + id: reproduction + attributes: + label: 复现步骤 + description: 提供能复现此问题的详细操作步骤 + placeholder: | + 1. 首先…… + 2. 然后…… + 3. 发生…… + validations: + required: true + + - type: textarea + id: expected + attributes: + label: 期望的结果 + description: 清晰简洁地描述你期望发生的事情 + + - type: textarea + id: logs + attributes: + label: 截图或日志 + description: 提供有助于诊断问题的任何日志和截图 diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..3ba13e0c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 00000000..fd41c417 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,20 @@ +name: 功能建议 +title: "feat: 功能描述" +description: 提出关于项目新功能的想法 +labels: ["enhancement"] +body: + - type: textarea + id: problem + attributes: + label: 希望能解决的问题 + description: 在使用中遇到什么问题而需要新的功能? + validations: + required: true + + - type: textarea + id: feature + attributes: + label: 描述所需要的功能 + description: 请说明需要的功能或解决方法 + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/plugin_config_edit.yml b/.github/ISSUE_TEMPLATE/plugin_config_edit.yml new file mode 100644 index 00000000..3e62bc05 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/plugin_config_edit.yml @@ -0,0 +1,33 @@ +name: 修改插件配置项 +title: "plugin: {name}" +description: 修改插件测试时的配置项 +labels: ["Plugin", "Config"] +body: + - type: input + id: pypi + attributes: + label: PyPI 项目名 + description: PyPI 项目名 + placeholder: e.g. nonebot-plugin-xxx + validations: + required: true + + - type: input + id: module + attributes: + label: 插件 import 包名 + description: 插件 import 包名 + placeholder: e.g. nonebot_plugin_xxx + validations: + required: true + + - type: textarea + id: config + attributes: + label: 插件配置项 + description: 插件配置项 + render: dotenv + placeholder: | + # e.g. + # KEY=VALUE + # KEY2=VALUE2 diff --git a/.github/workflows/noneflow.yml b/.github/workflows/noneflow.yml new file mode 100644 index 00000000..d819d22e --- /dev/null +++ b/.github/workflows/noneflow.yml @@ -0,0 +1,75 @@ +name: NoneFlow + +on: + issues: + types: [opened, reopened, edited] + pull_request_target: + types: [closed] + issue_comment: + types: [created] + pull_request_review: + types: [submitted] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.issue.number || github.run_id }} + cancel-in-progress: false + +jobs: + noneflow: + runs-on: ubuntu-latest + name: noneflow + # do not run on forked PRs, do not run on not related issues, do not run on pr comments + if: | + !( + ( + github.event.pull_request && + ( + github.event.pull_request.head.repo.fork || + !( + contains(github.event.pull_request.labels.*.name, 'Plugin') || + contains(github.event.pull_request.labels.*.name, 'Adapter') || + contains(github.event.pull_request.labels.*.name, 'Bot') + ) + ) + ) || + ( + github.event_name == 'issue_comment' && github.event.issue.pull_request + ) + ) + steps: + - name: Generate token + id: generate-token + uses: tibdex/github-app-token@v2 + with: + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.APP_KEY }} + + - name: Checkout Code + uses: actions/checkout@v4 + with: + token: ${{ steps.generate-token.outputs.token }} + + - name: Cache pre-commit hooks + uses: actions/cache@v4 + with: + path: .cache/.pre-commit + key: noneflow-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }} + + - name: NoneFlow + uses: docker://ghcr.io/nonebot/noneflow:latest + with: + config: > + { + "base": "master", + "plugin_path": "assets/plugins.json5", + "bot_path": "assets/bots.json5", + "adapter_path": "assets/adapters.json5", + "registry_repository": "nonebot/registry" + } + env: + APP_ID: ${{ secrets.APP_ID }} + PRIVATE_KEY: ${{ secrets.APP_KEY }} + PRE_COMMIT_HOME: /github/workspace/.cache/.pre-commit + + - name: Fix permission + run: sudo chown -R $(whoami):$(id -ng) .cache/.pre-commit diff --git a/src/types/results.ts b/src/types/results.ts index 7a6f968d..749b2f72 100644 --- a/src/types/results.ts +++ b/src/types/results.ts @@ -31,9 +31,7 @@ export interface Metadata { export interface Results { [K: string]: { - inputs: { - [K in "configs"]: string; - }; + config: string; outputs: { load: string; metadata: Metadata | null; diff --git a/src/views/PluginPage.vue b/src/views/PluginPage.vue index 1411c6d1..01681590 100644 --- a/src/views/PluginPage.vue +++ b/src/views/PluginPage.vue @@ -1,7 +1,7 @@