Dependencies Between Workflows on Github Actions

前端 未结 2 1234
挽巷
挽巷 2021-01-03 21:03

I have a monorepo with two workflows:

.github/workflows/test.yml

name: test

on: [push, pull_request]

jobs:
  test-packages:
    runs-o         


        
2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-03 21:46

    Update: It's now possible to create dependencies on workflows with workflow_run. See this answer.

    Is there a way to create a dependency between workflows?

    I don't think this is possible at the moment. Perhaps it's a feature they will add in future. Personally, I think it's more likely that a feature like CircleCI's orbs will get added to share common sections of workflows.

    For an alternative solution, does putting it all in the same workflow like the following work for you? The deploy-packages job will only execute if a tag starting with v is being pushed.

    name: my workflow
    on: [push, pull_request]
    jobs:
      test-packages:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v1
          - name: test packages
            run: echo "Running tests"
      deploy-packages:
        if: startsWith(github.ref, 'refs/tags/v')
        runs-on: ubuntu-latest
        needs: test-packages
        steps:
          - uses: actions/checkout@v1
          - name: deploy packages
            run: echo "Deploying packages"
    

提交回复
热议问题