A check for whether the dependency jobs are all green.

Overview

alls-green

A check for whether the dependency jobs are all green.

Why?

Do you have more than one job in your GitHub Actions CI/CD workflows setup? Do you use branch protection? Are you annoyed that you have to manually update the required checks in the repository settings hoping that you don't forget something on each improvement of the test matrix structure?

Yeah.. me too! But there's a solution — you can make a single check job listing all of the other jobs in its needs list. How about that? 🤯 Now you can add only that single job to your branch protection settings and you won't have to maintain that list manually anymore.

Right..? Wrong 🙁 — apparently, in case when something fails, the check job's result is set to skipped and not failed as one would expect. This is problematic and requires extra work to get it right. Some of it is iteration over the needed jobs and checking that all their results are set to success but it's no fun to maintain this sort of thing in many different repositories. Also, it is mandatory to make the check job run always, not only when all of the needed jobs succeed.

This is why I decided to make this action to simplify the maintenance.

--@webknjaz

:wq

Usage

To use the action add a check job to your workflow file (e.g. .github/workflows/ci-cd.yml) following the example below:

---
on:
  pull_request:
  push:

jobs:
  build:
    ...

  docs:
    ...

  linters:
    ...

  package-linters:
    needs:
    - build
    ...

  tests:
    needs:
    - build
    ...

  check:
    if: always()

    needs:
    - docs
    - linters
    - package-linters
    - tests

    runs-on: Ubuntu-latest

    steps:
    - name: Decide whether the needed jobs succeeded or failed
      uses: re-actors/[email protected]/v1
      with:
        allowed-failures: docs, linters
        allowed-skips: non-voting-flaky-job
        jobs: ${{ toJSON(needs) }}
...

Options

There are three options — allowed-failures, allowed-skips and jobs. The first two are optional but jobs is mandatory. allowed-failures tells the action which jobs should not affect the outcome if they don't succeed, by default all the jobs will be "voting". Same goes for allowed-skips — it won't allow the listed jobs to affect the outcome if they are skipped but are still "voting" in case they run. jobs is an object representing the jobs that should affect the decision of whether the pipeline failed or not, it is important to pass a JSON-serialized needs context to this argument.

Important: For this to work properly, it is a must to have the job always run, otherwise GitHub will make it skipped when any of the dependencies fail. In some contexts, skipped is interpreted as success which may lead to undersired, unobvious and even dangerous (as in security breach "dangerous") side-effects.

Whose idea is this?

My inspiration came from Zuul — a project gating system that practices having one "check-gate" that depends on multiple individual checks. Later when I started implementing this practice across the projects that I maintain, I discovered that I was not the only one who got the same idea @graingert posted a similar solution on the GitHub Community Forum. At some point I noticed that GitHub's auto-merge merges Dependabot PRs that are broken despite having branch protection enabled in the aiohttp repository, it wasn't obvious why. I stumbled on the solution accidentally, it was implemented in the PyCA/cryptography repository — the credit for that goes to @reaperhulk. He listed all of the needed jobs manually in the check. With those findings I've spent some time on experimentation and composing a more generic solution — this is how this GitHub Action came to be.

License

The contents of this project is released under the BSD 3-clause license.

Comments
  • Cancelled jobs result in a failure being reported

    Cancelled jobs result in a failure being reported

    https://github.com/pypa/pip/actions/runs/3210435710

    This triggers a notification if the jobs were auto-cancelled, for example due to concurrency protections.

    question wontfix 
    opened by pradyunsg 8
  • [TODO] Implement `allow-skips`

    [TODO] Implement `allow-skips`

    This has been suggested by @pradyunsg.

    Use-case: workflows that run jobs conditionally, depending on the files changed in associated PRs, for example — https://github.com/pypa/pip/blob/bbc7021/.github/workflows/ci.yml#L29-L49, using a change detection action like dorny/paths-filter.

    enhancement good first issue 
    opened by webknjaz 5
  • Deprecation warnings due to set-output

    Deprecation warnings due to set-output

    GitHub has deprecated the set-output way, so I'm getting warnings in my workflows from alls-green.

    Since they provided zero guidance how to fix it, I've written it down myself: https://hynek.me/til/set-output-deprecation-github-actions/

    tldr: echo "::set-output name=KEY::VALUE"echo "KEY=VALUE" >>$GITHUB_OUTPUT

    enhancement 
    opened by hynek 4
  • matrix job use case not covered or exemplified

    matrix job use case not covered or exemplified

    Apparently the current implementation does not count for matrix usage, thus not allowing you to ignore failure of one of matrix jobs.

    Sadly GHA unfortunate naming makes it harder to even refer to individual job run as from the human point of view each entry inside checks is a job. But from GHA workflow definition that is not exactly the same thing as matrix job-definitions get expanded into multiple job-runs with potential different names.

    How can we mark one particular matrix dimension as allowed to fail while still ensuring the the summarizing final "check" job does not fail?

    Most projects will avoid using different definitions for each job-run and use matrix for them, as that prevents repeating a huge number of tasks. Thus we do need a practical solution for allowing one matrix-entry to fail.

    documentation good first issue question 
    opened by ssbarnea 3
  • SyntaxError in normalize_needed_jobs_status.py

    SyntaxError in normalize_needed_jobs_status.py

    Hi This is how I added your action to my workflow:

    check:
        if: always()
        runs-on: [self-hosted]
        needs:
        - dev_build_int_tests
    
        steps:
        - name: Decide whether the needed jobs succeeded or failed
          uses: re-actors/a[email protected]
          with:
            jobs: ${{ toJSON(needs) }}
    

    And I got this error:

    Traceback (most recent call last):
     File "/usr/lib/python2.7/runpy.py", line 163, in _run_module_as_main
       mod_name, _Error)
     File "/usr/lib/python2.7/runpy.py", line 119, in _get_module_details
       code = loader.get_code(mod_name)
     File "/usr/lib/python2.7/pkgutil.py", line 281, in get_code
       self.code = compile(source, self.filename, 'exec')
     File "/opt/actions-runner/_work/_actions/re-actors/alls-green/v1.2.2/src/normalize_needed_jobs_status.py", line 29
       write_lines_to_streams((f'{name}={value}',), (outputs_file,))
                                               ^
    SyntaxError: invalid syntax
    Error: Process completed with exit code 1.
    

    Could you help me to fix it, please.

    opened by BuddyGlas 2
  • Include

    Include "Cancelled" in Skipped Statuses

    Jobs can be cancelled externally, either manually or automatically with an action. Cancelled jobs fall into the "failure" state of this action, and since they are not explicit failures they should be considered as "skipped" in the same way that jobs which are automatically skipped are.

    opened by tubbo 2
  • The execution status still green

    The execution status still green

    Sorry, maybe I don't understand how this action should work, but I added the check to my workflow, but I didn't get the expected result. Why is the execution status (number 1 in the screenshot) still green?

      check:
        if: always()
        runs-on: [self-hosted]
        needs:
        - dev_build_int_tests
    
        steps:
        - name: Install python3
          uses: actions/[email protected]
          with:
            python-version: '3.10'
    
        - name: Decide whether the needed jobs succeeded or failed
          uses: re-actors/a[email protected]
          with:
            jobs: ${{ toJSON(needs) }}
    

    2022-11-29_14-57

    opened by BuddyGlas 1
  • Requiring all jobs pass? (with a wildcard or some equivalent)

    Requiring all jobs pass? (with a wildcard or some equivalent)

    First of all, love the idea of this action, thanks for maintaining it.

    I was thinking about adopting this for https://github.com/di/pip-api/blob/master/.github/workflows/test.yml which has a somewhat complex (and long) matrix workflow. But based on the example in the readme and discussion in #5, it looks like I need to explicitly list all the jobs by name with needs:, and since the list of jobs is autogenerated, very long and changes frequently, I don't want to do this. Is there any workaround?

    Thanks!

    question 
    opened by di 0
Releases(v1.2.2)
  • v1.2.2(Oct 14, 2022)

    What's Changed

    Only the internals of the action have been updated to produce job step outputs through environment files^1. No UX changes were made. Additionally, the README has been improved to show how to allow individual matrix-defined jobs to fail and the outputs the action produces have been documented.

    Full Diff: https://github.com/re-actors/alls-green/compare/v1.2.1...v1.2.2

    Source code(tar.gz)
    Source code(zip)
  • v1.2.1(Sep 29, 2022)

    Bugfixes

    This release started processing trailing commas causing empty elements in allowed-failures and allowed-skips`.

    Full Diff: https://github.com/re-actors/alls-green/compare/v1.2.0...v1.2.1

    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Sep 24, 2022)

    What's New

    This release implements posting check details as a summary on the workflow overview page.

    Full Diff: https://github.com/re-actors/alls-green/compare/v1.1.0...v1.2.0

    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Dec 14, 2021)

  • v1.0.2(Dec 14, 2021)

    This is a patch release that includes bits of refactoring of the inline Python code block into its own module file and clarifications in the input descriptions.

    Source code(tar.gz)
    Source code(zip)
Owner
Re:actors
It's a home for GitHub Actions created by @webknjaz which react to the repository events. Research purposes, currently.
Re:actors
Joint Unsupervised Learning (JULE) of Deep Representations and Image Clusters.

Joint Unsupervised Learning (JULE) of Deep Representations and Image Clusters. Overview This project is a Torch implementation for our CVPR 2016 paper

Jianwei Yang 278 Dec 25, 2022
Implementation of a Transformer, but completely in Triton

Transformer in Triton (wip) Implementation of a Transformer, but completely in Triton. I'm completely new to lower-level neural net code, so this repo

Phil Wang 152 Dec 22, 2022
Scales, Chords, and Cadences: Practical Music Theory for MIR Researchers

ISMIR-musicTheoryTutorial This repository has slides and Jupyter notebooks for the ISMIR 2021 tutorial Scales, Chords, and Cadences: Practical Music T

Johanna Devaney 58 Oct 11, 2022
Repo for the paper "DiLBERT: Cheap Embeddings for Disease Related Medical NLP"

DiLBERT Repo for the paper "DiLBERT: Cheap Embeddings for Disease Related Medical NLP" Pretrained Model The pretrained model presented in the paper is

Kevin Roitero 2 Dec 15, 2022
U^2-Net - Portrait matting This repository explores possibilities of using the original u^2-net model for portrait matting.

U^2-Net - Portrait matting This repository explores possibilities of using the original u^2-net model for portrait matting.

Dennis Bappert 104 Nov 25, 2022
An implementation of the BADGE batch active learning algorithm.

Batch Active learning by Diverse Gradient Embeddings (BADGE) An implementation of the BADGE batch active learning algorithm. Details are provided in o

125 Dec 24, 2022
In this project, we create and implement a deep learning library from scratch.

ARA In this project, we create and implement a deep learning library from scratch. Table of Contents Deep Leaning Library Table of Contents About The

22 Aug 23, 2022
Imaginaire - NVIDIA's Deep Imagination Team's PyTorch Library

Imaginaire Docs | License | Installation | Model Zoo Imaginaire is a pytorch library that contains optimized implementation of several image and video

NVIDIA Research Projects 3.6k Dec 29, 2022
A list of all named GANs!

The GAN Zoo Every week, new GAN papers are coming out and it's hard to keep track of them all, not to mention the incredibly creative ways in which re

Avinash Hindupur 12.9k Jan 08, 2023
(CVPR2021) Kaleido-BERT: Vision-Language Pre-training on Fashion Domain

Kaleido-BERT: Vision-Language Pre-training on Fashion Domain Mingchen Zhuge*, Dehong Gao*, Deng-Ping Fan#, Linbo Jin, Ben Chen, Haoming Zhou, Minghui

248 Dec 04, 2022
Implements a fake news detection program using classifiers.

Fake news detection Implements a fake news detection program using classifiers for Data Mining course at UoA. Description The project is the categoriz

Apostolos Karvelas 1 Jan 09, 2022
The project page of paper: Architecture disentanglement for deep neural networks [ICCV 2021, oral]

This is the project page for the paper: Architecture Disentanglement for Deep Neural Networks, Jie Hu, Liujuan Cao, Tong Tong, Ye Qixiang, ShengChuan

Jie Hu 15 Aug 30, 2022
Using pretrained GROVER to extract the atomic fingerprints from molecule

Extracting atomic fingerprints from molecules using pretrained Graph Neural Network models (GROVER).

Xuan Vu Nguyen 1 Jan 28, 2022
Ranger - a synergistic optimizer using RAdam (Rectified Adam), Gradient Centralization and LookAhead in one codebase

Ranger-Deep-Learning-Optimizer Ranger - a synergistic optimizer combining RAdam (Rectified Adam) and LookAhead, and now GC (gradient centralization) i

Less Wright 1.1k Dec 21, 2022
A Peer-to-peer Platform for Secure, Privacy-preserving, Decentralized Data Science

PyGrid is a peer-to-peer network of data owners and data scientists who can collectively train AI models using PySyft. PyGrid is also the central serv

OpenMined 615 Jan 03, 2023
In the AI for TSP competition we try to solve optimization problems using machine learning.

AI for TSP Competition Goal In the AI for TSP competition we try to solve optimization problems using machine learning. The competition will be hosted

Paulo da Costa 11 Nov 27, 2022
Liquid Warping GAN with Attention: A Unified Framework for Human Image Synthesis

Liquid Warping GAN with Attention: A Unified Framework for Human Image Synthesis, including human motion imitation, appearance transfer, and novel view synthesis. Currently the paper is under review

2.3k Jan 05, 2023
AOT-GAN for High-Resolution Image Inpainting (codebase for image inpainting)

AOT-GAN for High-Resolution Image Inpainting Arxiv Paper | AOT-GAN: Aggregated Contextual Transformations for High-Resolution Image Inpainting Yanhong

Multimedia Research 214 Jan 03, 2023
Utilities to bridge Canvas-generated course rosters with GitLab's API.

gitlab-canvas-utils A collection of scripts originally written for CSE 13S. Oversees everything from GitLab course group creation, student repository

Eugene Chou 5 Jun 08, 2022
PyTorch implementation of the paper Dynamic Data Augmentation with Gating Networks

Dynamic Data Augmentation with Gating Networks This is an official PyTorch implementation of the paper Dynamic Data Augmentation with Gating Networks

九州大学 ヒューマンインタフェース研究室 3 Oct 26, 2022