diff --git a/CHANGELOG.md b/CHANGELOG.md index b97ab945..b35b871f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/lang/zh-CN/ ## [Unreleased] +### Added + +- 遵守 debug logging 的设置 + ### Changed - 设置时区为中国 diff --git a/bot.py b/bot.py index 544b7125..fb6bca8c 100644 --- a/bot.py +++ b/bot.py @@ -74,9 +74,14 @@ def payload_to_event( with ensure_cwd(Path(__file__).parent): app_id = os.environ.get("APP_ID") private_key = os.environ.get("PRIVATE_KEY") + # https://docs.github.com/en/actions/learn-github-actions/contexts#runner-context + # 如果设置时,值总是为 "1" + runner_debug = os.environ.get("RUNNER_DEBUG", "0") nonebot.init( - driver="~none", github_apps=[{"app_id": app_id, "private_key": private_key}] + driver="~none", + github_apps=[{"app_id": app_id, "private_key": private_key}], + log_level="DEBUG" if runner_debug == "1" else "INFO", ) driver = nonebot.get_driver()