mirror of
https://github.com/PaiGramTeam/PaiGramMetadata.git
synced 2024-11-21 14:38:22 +00:00
👷 Check gcsim scripts pr
This commit is contained in:
parent
d067c5e1c2
commit
94df038aff
31
.github/workflows/pr.yml
vendored
Normal file
31
.github/workflows/pr.yml
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
name: PR Check for gcsim scripts
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'gcsim/scripts/**'
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
|
||||
jobs:
|
||||
pr-check:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.11
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
python -m pip install -r gcsim/requirements.txt
|
||||
|
||||
- name: Check GCSIM scripts
|
||||
run: |
|
||||
python gcsim/main.py pr
|
@ -6,6 +6,7 @@ from pathlib import Path
|
||||
import aiofiles
|
||||
import re
|
||||
import gcsim_pypi
|
||||
import sys
|
||||
|
||||
data_path = Path("gcsim.json")
|
||||
gcsim_path = Path("gcsim")
|
||||
@ -41,9 +42,14 @@ async def run_gcsim(path: Path) -> bool:
|
||||
_, stderr = await process.communicate()
|
||||
err = stderr.decode()
|
||||
if err:
|
||||
print(f"{path.name} 解析失败 {err}")
|
||||
text = f"{path.name} 解析失败 \n\n{err}"
|
||||
if sys.argv[-1] == "pr":
|
||||
raise ValueError(text)
|
||||
print(text)
|
||||
return False
|
||||
return True
|
||||
except ValueError as e:
|
||||
raise e
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user