小编Pau*_* CV的帖子

当工作流测试失败时,如何避免在 Github 上推送?

我创建了工作流程来在提交之前测试我的 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)

python testing github github-actions

5
推荐指数
1
解决办法
3674
查看次数

标签 统计

github ×1

github-actions ×1

python ×1

testing ×1