相同的 python 版本,相同的 sqlite3 版本和相同的文件,但我只是无法传递 Github Action。
这是我的 github 操作:https://github.com/CloudAurora/Blog/blob/master/.github/workflows/main.yml https://github.com/CloudAurora/Blog/blob/master/.github/workflows/main.yml
和我的 python 文件:https://github.com/CloudAurora/Blog/blob/master/scripts/init_database.py https://github.com/CloudAurora/Blog/blob/master/scripts/init_database.py
我可以在本地 Linux 机器上成功运行这个文件:
Projects/Blog - [master●] » python scripts/init_database.py -r ./posts --token xxx
sqlite version 2.6.0
INSERT_USER_STATEMENT
INSERT INTO User(bio, email, githubId, name)
VALUES(?,?,?,?)
ON CONFLICT(name) DO NOTHING
INSERT_USER_STATEMENT
INSERT INTO User(bio, email, githubId, name)
VALUES(?,?,?,?)
ON CONFLICT(name) DO NOTHING
Create db file in: ./prisma/dev.db, and env is set
但是,当我将其推送到 github 时,它会在 Github Action 中失败:
sqlite version 2.6.0
INSERT_USER_STATEMENT
INSERT INTO User(bio, email, githubId, name)
VALUES(?,?,?,?)
ON CONFLICT(name) DO NOTHING
Traceback (most recent call last):
File "scripts/init_database.py", line 110, in <module>
c.execute(INSERT_USER_STATEMENT, author_info)
sqlite3.OperationalError: near "ON": syntax error
##[error]Process completed with exit code 1.
你可以找到完整的日志:https://github.com/CloudAurora/Blog/runs/899163805?check_suite_focus=true https://github.com/CloudAurora/Blog/runs/899163805?check_suite_focus=true