mirror of
https://github.com/hex-ci/smzdm_script.git
synced 2026-11-03 14:15:25 +08:00
Fail the github action when failure
This commit is contained in:
7
main.py
7
main.py
@@ -13,6 +13,8 @@ from utils.file_helper import TomlHelper
|
|||||||
CURRENT_PATH = Path(__file__).parent.resolve()
|
CURRENT_PATH = Path(__file__).parent.resolve()
|
||||||
CONFIG_PATH = Path(CURRENT_PATH, "config")
|
CONFIG_PATH = Path(CURRENT_PATH, "config")
|
||||||
|
|
||||||
|
MANUAL_ERR_MSG = "签到失败,请从浏览器手动签到一次,并更新cookies"
|
||||||
|
|
||||||
|
|
||||||
class SMZDM_Bot(object):
|
class SMZDM_Bot(object):
|
||||||
|
|
||||||
@@ -68,7 +70,7 @@ class SMZDM_Bot(object):
|
|||||||
return msg
|
return msg
|
||||||
else:
|
else:
|
||||||
logger.error("Faile to sign in")
|
logger.error("Faile to sign in")
|
||||||
msg = "签到失败,请从浏览器手动签到一次,并更新cookies"
|
msg = MANUAL_ERR_MSG
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@@ -105,6 +107,9 @@ def main():
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
msg = smzdm_bot.checkin()
|
msg = smzdm_bot.checkin()
|
||||||
NotifyBot(content=msg, **conf_kwargs)
|
NotifyBot(content=msg, **conf_kwargs)
|
||||||
|
if msg == MANUAL_ERR_MSG:
|
||||||
|
logger.error("Fail the Github action job")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user