All Projects → mheap → github-action-required-labels

mheap / github-action-required-labels

Licence: MIT license
Fail the build if/unless a certain combination of labels are applied to a pull request

Programming Languages

javascript
184084 projects - #8 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to github-action-required-labels

changed-files
Github action to retrieve all (added, copied, modified, deleted, renamed, type changed, unmerged, unknown) files and directories.
Stars: ✭ 733 (+1828.95%)
Mutual labels:  github-action
lcov-cop
A Github Action which helps enforce code coverage
Stars: ✭ 13 (-65.79%)
Mutual labels:  github-action
spellcheck-action
GitHub Action for checking code & Pull Requests for spelling mistakes
Stars: ✭ 35 (-7.89%)
Mutual labels:  github-action
action-netlify-deploy
🙌 Netlify deployments via GitHub actions
Stars: ✭ 32 (-15.79%)
Mutual labels:  github-action
composer-normalize-action
+ 🎵 Provides a GitHub action for running ergebnis/composer-normalize.
Stars: ✭ 25 (-34.21%)
Mutual labels:  github-action
clojure-dependency-update-action
A simple GitHub Actions job to create Pull Requests for outdated dependencies in clojure projects
Stars: ✭ 37 (-2.63%)
Mutual labels:  github-action
mpv-winbuild
Use Github Action to build mpv for Windows with latest commit.
Stars: ✭ 78 (+105.26%)
Mutual labels:  github-action
translation-action
GitHub action that translates any text to any language supported by chosen provider.
Stars: ✭ 25 (-34.21%)
Mutual labels:  github-action
aws-secrets-manager-actions
🔒 GitHub Action for AWS Secrets Manager
Stars: ✭ 53 (+39.47%)
Mutual labels:  github-action
googlejavaformat-action
GitHub Action that formats Java files following Google Style guidelines
Stars: ✭ 66 (+73.68%)
Mutual labels:  github-action
org-audit-action
GitHub Action that provides an Organization Membership Audit
Stars: ✭ 34 (-10.53%)
Mutual labels:  github-action
codeowners-validator
The GitHub CODEOWNERS file validator
Stars: ✭ 142 (+273.68%)
Mutual labels:  github-action
create-or-update-project-card
A GitHub action to create or update a project card
Stars: ✭ 36 (-5.26%)
Mutual labels:  github-action
ticket-check-action
Verify that pull request titles start with a ticket ID
Stars: ✭ 29 (-23.68%)
Mutual labels:  github-action
setup-gcc
GitHub action to set up GCC
Stars: ✭ 51 (+34.21%)
Mutual labels:  github-action
find-comment
A GitHub action to find an issue or pull request comment
Stars: ✭ 81 (+113.16%)
Mutual labels:  github-action
chainalert-github-action
scans popular packages and alerts in cases there is suspicion of an account takeover
Stars: ✭ 38 (+0%)
Mutual labels:  github-action
github-deploy-actions
This action will auto deploy to target branch when it get triggered
Stars: ✭ 24 (-36.84%)
Mutual labels:  github-action
Github-Android-Action
Android Github Action that builds Android project, runs unit tests and generates debug APK, builds for Github Actions hackathon
Stars: ✭ 29 (-23.68%)
Mutual labels:  github-action
standard-action
Github Action to lint with `standard` and friends
Stars: ✭ 15 (-60.53%)
Mutual labels:  github-action

github-action-required-labels

This action allows you to fail the build if/unless a certain combination of labels are applied to a pull request.

Usage

This action has three inputs:

labels

This is a list of comma separated labels to match on.

labels: 'label-one, another:label, bananas'

mode

One of: exactly, minimum, maximum

count

The number of labels to apply mode to

Examples

Complete example

name: Pull Request Labels
on:
  pull_request:
    types: [opened, labeled, unlabeled, synchronize]
jobs:
  label:
    runs-on: ubuntu-latest
    steps:
      - uses: mheap/github-action-required-labels@v2
        with:
          mode: exactly
          count: 1
          labels: "semver:patch, semver:minor, semver:major"

By default this actions reads event.json, which will not detect when a label is added in an earlier step. To force an API call, set the GITHUB_TOKEN environment variable like so:

- uses: mheap/github-action-required-labels@v2
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  with:
    mode: exactly
    count: 1
    labels: "semver:patch, semver:minor, semver:major"

Prevent merging if a label exists

- uses: mheap/github-action-required-labels@v2
  with:
    mode: exactly
    count: 0
    labels: "do not merge"

Require multiple labels

- uses: mheap/github-action-required-labels@v2
  with:
    mode: minimum
    count: 2
    labels: "community-reviewed, team-reviewed, codeowner-reviewed"

Exit with a neutral result rather than failure

- uses: mheap/github-action-required-labels@v2
  with:
    mode: minimum
    count: 2
    labels: "community-reviewed, team-reviewed, codeowner-reviewed"
    exit_type: success # Can be: success or failure (default: failure)

You can set exit_type to success then inspect outputs.status to see if the action passed or failed. This is useful when you want to perform additional actions if a label is not present, but not fail the entire build.

If the action passed, outputs.status will be success. If it failed, outputs.status will be failure.

Here is a complete workflow example for this use case:

name: Pull Request Labels
on:
  pull_request:
    types: [opened, labeled, unlabeled, synchronize]
jobs:
  label:
    runs-on: ubuntu-latest
    outputs:
      status: ${{ steps.check-labels.outputs.status }}
    steps:
      - id: check-labels
        uses: mheap/github-action-required-labels@v2
        with:
          mode: exactly
          count: 1
          labels: "semver:patch, semver:minor, semver:major"
          exit_type: success
  do-other:
    runs-on: ubuntu-latest
    needs: label
    steps:
      - run: echo SUCCESS
        if: needs.label.outputs.status == 'success'
      - run: echo FAILURE && exit 1
        if: needs.label.outputs.status == 'failure'
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].