Code Monkey home page Code Monkey logo

cancel-gh-workflow's Introduction

cancel-gh-workflow

Cancel the selected workflow actions for a faster feedback.

Use-case:

For example:

Your github repo have two github actions workflow files node-test.yml and django-test.yml run simultaneously triggered on pull_request

If the node-test.yml workflow is failed, you don't want to continue the workflow run with django-test.yml

Usage

node-test.yml

Here if the job failed for node-test.yml, the action will cancel all the jobs running by the django-test.yml workflow

name: Node CI Test

on:
  pull_request:
    types:
      - opened
      - reopened
      - synchronize
      - ready_for_review
jobs:
  job-1:
    name: Run node job1
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: Extract branch name
      id: extract_branch
      run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"

    - run: exit 1

    - uses: vishnudxb/[email protected]
      if: failure()
      with:
        repo: octocat/hello-world
        branch_name: ${{ steps.extract_branch.outputs.branch }}
        workflow_file_name: django-test.yml
        access_token: ${{ github.token }}

django-test.yml

Here if the job failed for django-test.yml, the action will cancel all the jobs running by the node-test.yml workflow

name: Django CI Test

on:
  pull_request:
    types:
      - opened
      - reopened
      - synchronize
      - ready_for_review

jobs:
  job-1:
    name: Run django job1
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: Extract branch name
      id: extract_branch
      run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"

    - run: exit 1

    - uses: vishnudxb/[email protected]
      if: failure()
      with:
        repo: octocat/hello-world
        branch_name: ${{ steps.extract_branch.outputs.branch }}
        workflow_file_name: node-test.yml
        access_token: ${{ github.token }}

cancel-gh-workflow's People

Contributors

vishnudxb avatar

Watchers

 avatar  avatar  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.