官方 Github Actions 文档中提到,可以设置 defaults
来为所有作业指定默认设置 (https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#defaults)。我想设置它来指定
defaults:
runs-on: ubuntu-latest
strategy:
fail-fast: false # do not cancel 7.2 if 7.3 fails
matrix:
php: ['7.2', '7.3', '7.4']
node-version: ['12.5']
jobs:
...
但是这在处理中会失败。
The workflow is not valid. .github/workflows/code_checks.yaml (Line: 7, Col: 3): Unexpected value 'runs-on',.github/workflows/code_checks.yaml (Line: 8, Col: 3): Unexpected value 'strategy'
我希望为所有作业指定相同的 runs-on
和 strategy
。为什么defaults
不能正常工作?