最佳答案
我有一个带有两个工作流的 monorepo:
.github/workflows/test.yml
name: test
on: [push, pull_request]
jobs:
test-packages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: test packages
run: |
yarn install
yarn test
...
.github/workflows/deploy.yml
name: deploy
on:
push:
tags:
- "*"
jobs:
deploy-packages:
runs-on: ubuntu-latest
needs: test-packages
steps:
- uses: actions/checkout@v1
- name: deploy packages
run: |
yarn deploy
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
...
这不管用,我不能在另一个工作流中引用一个工作:
### ERRORED 19:13:07Z
- Your workflow file was invalid: The pipeline is not valid. The pipeline must contain at least one job with no dependencies.
是否有方法在工作流之间创建依赖关系?
我想要的是在标签上运行 test.yml
,然后在标签上运行 deploy.yml
,只在推和拉请求上运行 test.yml
。我不想在工作流之间重复作业。