Giter Site home page Giter Site logo

workflow-wait-action's Introduction

Wait Last Action

Build status

A GitHub Action that waiting for last action run complete.

Scenarios of use

  • monorepo: a workflow needs to wait for multiple other workflows to complete
  • deploy or run e2e tests once: run a deployment + e2e workflow only after multiple build + unit test workflows are successfully completed

Can I do this with Github already?

Out of the box, Github does not seem to provide a way to only run a workflow once, after other workflows are completed.

The default behavior of the native workflow_run event trigger is to:

  • not wait for all dependent workflows to complete to trigger the workflow
  • trigger the workflow multiple times (for each completed/dependent workflow)

The workflow_run event will also only trigger a workflow run if the workflow file is on the default branch, typically master or main.

Usage

The following examples show how to configure a workflow named workflow-last.

workflow-last will wait for any other workflows (triggered in the same branch) to complete and then resume its own steps.

Simple example

name: workflow-last

jobs:
  always_last:
    steps:
      - name: Pause until all workflows are completed
        uses: ygqygq2/workflow-wait-action@v1

      - name: Resume and run once, after all workflows are completed
        run: date

Example with options

name: workflow-last

jobs:
  always_last:
    steps:
      - name: Pause until all workflows are completed
        uses: ygqygq2/workflow-wait-action@v1
        with:
          access_token: ${{ secrets.GITHUB_TOKEN }}
          timeout: 600
          interval: 10
          initial_delay: 0
          associated_workflows: false

      - name: Resume and run once, after all workflows are completed
        run: date

Options

Syntax Description Mandatory? Default value Example value
access_token Your GitHub Access Token No {{ github.token }}
timeout Action timeout. If in-progress workflows are not completed within the timeout period, the Action will fails the workflow No 600
interval Interval used to poll the status of the workflows No 10
initial_delay Initial delay used to give minimal time to all workflows to be queued & started No 0
associated_workflows Wait workflow runs that are associated with the head_sha. If set to true, the action will wait for all workflows that are associated with this workflow with the same head_sha No false
workflows List of workflows to wait for. Must be a multiline string using No '' |
workflow-1
workflow-2

Limitations

Given the following workflows:

  • workflow-1 (takes 5 minutes)
  • workflow-2 (takes 45 minutes)
  • workflow-last (configured to pause until workflow-1 and workflow-2 are completed, takes 10m)

workflow-last will at minimum use 55 minutes/month (= 45 + 10 minutes) of your Github CI plan due to all workflows effectively starting at the same time.

workflow-wait-action's People

Contributors

ygqygq2 avatar willgarcia avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.