【发布时间】:2022-01-01 22:50:46
【问题描述】:
我在 GitHub 操作中设置了一个工作流来运行我的测试并创建测试覆盖率的工件。我的 YAML 文件的精简版如下所示:
name: Build
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
# Other steps here
- name: Build app
- name: Run tests
- name: Create artifact of test coverage
# Other steps here
问题是测试失败时没有创建工件。
我从docs 中发现了if: always() 的条件,但是当我的Build app 步骤失败时,这也会导致此步骤运行。我不希望这种情况发生,因为在这种情况下没有什么可归档的。
如果上一步已经运行(成功或失败),我如何才能运行这一步?
【问题讨论】:
标签: github continuous-integration continuous-deployment github-actions