我创建了工作流程来在提交之前测试我的 Python 应用程序。问题是,如果测试失败,提交无论如何都会被推送。如果测试不成功,我如何添加一个条件来避免推送?
工作流程文件 .yml 的结构如下。
name: Python application
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . …Run Code Online (Sandbox Code Playgroud)