Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add a do not merge label that prevents merging #1684

@Snailedlt

Description

@Snailedlt

Discussed in #1429

Originally posted by Snailedlt October 4, 2022
Would it be useful to have a do not merge label?
Maybe the PR could have a job that fails if the label is applied too.

Example implementation from here: https://www.jessesquires.com/blog/2021/08/24/useful-label-based-github-actions-workflows/#updated-21-march-2022

name: Do Not Merge

on:
  pull_request:
    types: [synchronize, opened, reopened, labeled, unlabeled]

jobs:
  do-not-merge:
    if: ${{ contains(github.event.*.labels.*.name, 'do not merge') }}
    name: Prevent Merging
    runs-on: ubuntu-latest
    steps:
      - name: Check for label
        run: |
          echo "Pull request is labeled as 'do not merge'"
          echo "This workflow fails so that the pull request cannot be merged"
          exit 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    devopsDevops/automation related enhancementsgood first issueHelp new contributors find good first issue

    Type

    No type

    Projects

    Status

    To-do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions