Skip to content
This repository has been archived by the owner on Dec 18, 2021. It is now read-only.

crossnokaye/no-failures-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

No Failures Action

A GitHub Action that fails if any previous Job in the needs graph fails.

Usage

The main purpose of this Action is to provide a consistent signal for a repository's protected branch required checks. By default, a failed Job causes all dependent jobs (defined by the jobs.<job_id>.needs field in the Workflow YAML) to be marked as skipped. A skipped status check is interpreted as a successful status by the branch protection mechanism, permitting a merge despite the actual failure.

This action walks the needs dependency graph, and fails if any of the previous jobs have failed:

# /.github/workflows/my-workflow.yml
# ...

jobs:
  A: #...

  B: #...

  Ready-To-Merge:
    needs: [A, B] # Fails if A or B (or any of their dependencies) fail
    if: always() # Required!
    runs-on: ubuntu-latest # Any OS that supports Node v12
    steps:
      - uses: crossnokaye/[email protected]

Inputs

Note: all inputs to a GitHub Action must be strings.

github-token

Optional? yes Default? the default GITHUB_TOKEN provided to the Job

Specify the GitHub API token to use to query job status and workflow definition information.

jobs:
  Ready-To-Merge:
    steps:
      - uses: crossnokaye/[email protected]
        with:
          github-token: a-custom-token

Alternatively, jobs.<job_id>.permissions can be used to limit the scope of the token. This Action requires at least actions: read and contents: read permissions to operate:

jobs:
  Ready-To-Merge:
    permissions:
      actions:  read
      contents: read
    steps:
      - uses: crossnokaye/[email protected]

failure-statuses

Optional? yes Default? ["failure", "cancelled"]

Defines the Job conclusions that should be considered a failure by this Action. At the time of writing, conclusions can be one of success, failure, cancelled, or skipped.

jobs:
  Ready-To-Merge:
    steps:
      - uses: crossnokaye/[email protected]
        with:
          failure-statuses: '["failure", "skipped", "cancelled"]'

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published