Git Product home page Git Product logo

workflow-dispatcher's Introduction

Workflow Dispatcher | GitHub Action

GitHub release

About

Lightweight composite steps Github Action for triggering a workflow in a different repository and waiting until its completion. Inspired by Trigger Workflow And Wait Action.

Why use this Action?

  • Being a composite run steps Action, it is lightweight compared to the original Docker based Action.
  • It adds checks to ensure that the correct workflow is identified and waited upon.
  • It provides a link to the output of the remote workflow and shows details about the last commit in the branch/tag of the remote repo.

When should you use it?

When creating a workflow which deploys an entire distributed application in one go, spread across multiple repos. Since this Action waits for each workflow to complete, it will provide a holistic view of the deployment status in a single place.

Pre-requisites

  • The target workflow should have a Repository Dispatch trigger.
  • A personal access token (PAT) will be needed to trigger the remote workflow.
    • The scope of the default GitHub token is limited to the current repository only. Hence, it cannot be used.
    • The PAT should have access to run workflows in the target repository.
    • GitHub guide for creating a PAT is available here.
  • Preferably, use this Action on a GitHub hosted runner. This is needed for avoiding issues arising from inconsistencies between timestamps returned from the runner and the GitHub API. This will not be a concern if the system clock on the self-hosted runner is accurate.

Inputs

Name Required Default Description
owner True null The owner of the target repository where the workflow is to be triggered.
repo True null The target repository where the workflow is to be triggered.
token True null The Github access token with access to the target repository. Its recommended you put it under secrets.
event_type True null The event type that is configured in the repository dispatch trigger in the target workflow.
wait_time False 10 The number of seconds delay between checking for the result of the target workflow.
max_time False 600 Maximum amount of time to wait for workflow to complete (seconds).
client_payload False "{}" Payload for the repository dispatch event. Usually used for passing a Git Ref to the target workflow.

Outputs

Name Description
workflow-id ID of the triggered workflow.
conclusion Result of the triggered workflow.

Example Usage

    - name: Deploy Your Service
      uses: adityakar/workflow-dispatcher
      with:
        owner: your-github-org
        repo: your-repo
        token: ${{ secrets.PAT }}
        event_type: dev-deploy
        client_payload: '{"git-ref": "${{ github.event.inputs.git-ref }}"}'
        wait_time: 5
        max_time: 180

workflow-dispatcher's People

Contributors

aditya-kar 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.