Skip to content

Add a do not merge label that prevents merging #1684

Open

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

Activity

  1. added
    devopsDevops, devex and automation related enhancements
    on Feb 18, 2023
  2. Finii commented on Sep 5, 2024

    @Finii
    Contributor

    Just a comment from the off ;-)

    How does setting this label differs from converting the PR to a draft? Number of clicks is about the same.
    I usually use draft-PRs for this... not good to merge: is a draft PR.

    • It gets a special symbol (grey) when linked.
    • It can not be merged.

    This feature also exists on gitlab, so ppl know this approach probably?

    image

    Grey Draft-PR icon on github

    image

    PR list with 'do not merge' eerrr 'draft' status

    image

    Location of button in the sidebar ...

    image

    ...while un-drafting is in the bottom 😬

    Edit: Add button location images

  3. Snailedlt commented on Sep 5, 2024

    @Snailedlt
    CollaboratorAuthor

    @Finii I thought only the author could change the PR to draft. If maintainers also can draft the PR this could work. Only downside I can see is that the author can change it back to a non-draft PR, while with labels only those with permission can do that.

    Thanks for the input :)

  4. Finii commented on Sep 6, 2024

    @Finii
    Contributor

    At least I could change this PR to draft ;-)

    The indication that something with the PR is amiss (can not be merged for some reason) with the grey symbol is quite nice.
    Otoh, what do I know how you distribute rights etc. In less complex situations it works rather well; and usually it is not turned back to mark non-draft without a good reason and/or successful discussion etc.

    Just wanted to point to that 👍

    image

    https://www.github.com/ryanoasis/nerd-fonts/pull/1666

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    devopsDevops, devex and automation related enhancementsgood first issueHelp new contributors find good first issue

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions