👷 CI 添加缓存

This commit is contained in:
omg-xtao 2022-10-09 00:12:31 +08:00 committed by GitHub
parent e935d04082
commit 262ae70d66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 5 deletions

29
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,29 @@
## 该 PR 相关 Issue / Involved issue
Close #
## 描述 / Description
```
```
## 更改检查表 / Change Checklist
- [ ] 有插件命令更新
- [ ] 已更新 bot 帮助文件
- [ ] 有流程交互
- [ ] 指引明确
- [ ] 可以退出
- [ ] 会触发频率限制
- [ ] 有对应的限制措施
- [ ] 需要用户输入数据
- [ ] 验证用户数据
- [ ] 如果是文件,检查了文件大小
- [ ] 对保存的数据再次进行了验证
- [ ] 添加了新的依赖包
- [ ] 测试
- [ ] 本地通过了测试
- [ ] CI 通过了测试
## 说明 / Note

View File

@ -32,12 +32,14 @@ jobs:
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Install poetry - name: restore or create a python virtualenv
id: cache
uses: syphar/restore-virtualenv@v1.2
- name: Create venv
if: steps.cache.outputs.cache-hit != 'true'
run: | run: |
pip install --upgrade poetry pip install --upgrade poetry
poetry config virtualenvs.create false poetry config virtualenvs.create false
- name: Install dependencies
run: |
poetry install poetry install
poetry install --extras test poetry install --extras test
- name: Test with pytest - name: Test with pytest

View File

@ -59,13 +59,17 @@ class GetChat(Plugin):
except UserNotFoundError: except UserNotFoundError:
user_info = None user_info = None
if user_info is not None: if user_info is not None:
text += "米游社绑定:" if user_info.region == RegionEnum.HYPERION else "HOYOLAB 绑定:" if user_info.region == RegionEnum.HYPERION:
text += "米游社绑定:"
uid = user_info.yuanshen_uid
else:
text += "原神绑定:"
uid = user_info.genshin_uid
temp = "Cookie 绑定" temp = "Cookie 绑定"
try: try:
await get_genshin_client(chat.id) await get_genshin_client(chat.id)
except CookiesNotFoundError: except CookiesNotFoundError:
temp = "UID 绑定" temp = "UID 绑定"
uid = user_info.genshin_uid or user_info.yuanshen_uid
text += f"<code>{temp}</code>\n" \ text += f"<code>{temp}</code>\n" \
f"游戏 ID<code>{uid}</code>" f"游戏 ID<code>{uid}</code>"
with contextlib.suppress(Exception): with contextlib.suppress(Exception):