Skip to content

Commit 9d272bf

Browse files
committed
fix: 通过环境变量传递插件配置
命令行中和外层相同的引号会消失掉。
1 parent 88b9688 commit 9d272bf

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,9 @@ jobs:
201201
poetry run python -m src.utils.store_test --offset ${{ github.event.inputs.offset || 0 }} --limit ${{ github.event.inputs.limit || 50 }} ${{ github.event.inputs.args }}
202202
- name: Update registry(Plugin)
203203
if: github.event.client_payload.type == 'Plugin'
204-
run: poetry run python -m src.utils.store_test -k "${{ github.event.client_payload.key }}" -c "${{ github.event.client_payload.config }}" -f
204+
run: poetry run python -m src.utils.store_test -k '${{ github.event.client_payload.key }}' -f
205+
env:
206+
PLUGIN_CONFIG: ${{ github.event.client_payload.config }}
205207
- name: Upload results
206208
uses: actions/upload-artifact@v3
207209
with:

src/utils/store_test/__main__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
from asyncio import run
23

34
import click
@@ -27,11 +28,14 @@
2728
@click.option("-o", "--offset", default=0, show_default=True, help="测试插件偏移量")
2829
@click.option("-f", "--force", is_flag=True, help="强制重新测试")
2930
@click.option("-k", "--key", default=None, show_default=True, help="测试插件标识符")
30-
@click.option("-c", "--config", default=None, show_default=True, help="测试插件配置")
31-
def main(limit: int, offset: int, force: bool, key: str | None, config: str | None):
31+
def main(limit: int, offset: int, force: bool, key: str | None):
3232
from .store import StoreTest
3333

3434
test = StoreTest(offset, limit, force)
35+
36+
# 通过环境变量传递插件配置
37+
config = os.environ.get("PLUGIN_CONFIG")
38+
3539
run(test.run(key, config))
3640

3741

0 commit comments

Comments
 (0)