首页 > 解决方案 > 通过 bash 脚本运行 pytest 时使 github 操作失败

问题描述

我们pytest使用 bash 脚本运行,并且需要基于 pytest 退出代码使 GitHub 操作失败。

GitHub 操作

name: Setup Glue and run unit tests
run: |
chmod +x mycoverage
./mycoverage file_dir

bash 脚本

#!/usr/bin/env bash

coverage run -m pytest "$@"
coverage xml -i

我们可以从中获取退出代码,$?并且需要知道如何根据$?bash 脚本中的(非零值)使 GitHub 操作失败。

标签: bashunit-testinggithubpytestgithub-actions

解决方案


推荐阅读