Github 操作:运行 步失败后的步骤,但仅在计划时
Github actions: Run step after failed step, but only when scheduled
我下面有 github actions/workflow 文件。如果任何测试失败或引发异常,行为执行将跳过报告上传以吸引。我能够通过在下一步中使用 always()
来修复它,但不幸的是,现在即使我们手动 运行 测试,报告仍在上传,我们只想在计划时上传(每日计算)。有人知道如何实现吗?
...
- name: Run BDD tests
env:
STAGE_EMAIL: ${{ secrets.STAGE_EMAIL }}
STAGE_PASSWORD: ${{ secrets.STAGE_PASSWORD }}
run: |
rm -rf allure-results
mkdir -p allure-results
behave --junit --junit-directory allure-results
- name: Upload test report to Allure
if: ${{ always() }} && github.event_name == 'schedule'
env:
ALLURE_SERVER: ${{ secrets.ALLURE_SERVER }}
run: |
python send_test_results.py $GITHUB_REPOSITORY $GITHUB_RUN_ID $ALLURE_SERVER default
...
这个表达式会做你想做的事 ${{ always() && github.event_name == 'schedule' }}
。
我下面有 github actions/workflow 文件。如果任何测试失败或引发异常,行为执行将跳过报告上传以吸引。我能够通过在下一步中使用 always()
来修复它,但不幸的是,现在即使我们手动 运行 测试,报告仍在上传,我们只想在计划时上传(每日计算)。有人知道如何实现吗?
...
- name: Run BDD tests
env:
STAGE_EMAIL: ${{ secrets.STAGE_EMAIL }}
STAGE_PASSWORD: ${{ secrets.STAGE_PASSWORD }}
run: |
rm -rf allure-results
mkdir -p allure-results
behave --junit --junit-directory allure-results
- name: Upload test report to Allure
if: ${{ always() }} && github.event_name == 'schedule'
env:
ALLURE_SERVER: ${{ secrets.ALLURE_SERVER }}
run: |
python send_test_results.py $GITHUB_REPOSITORY $GITHUB_RUN_ID $ALLURE_SERVER default
...
这个表达式会做你想做的事 ${{ always() && github.event_name == 'schedule' }}
。