Skip to content

Conversation

Sashan
Copy link
Contributor

@Sashan Sashan commented Aug 11, 2025

No description provided.

@Sashan
Copy link
Contributor Author

Sashan commented Aug 11, 2025

I think the gmerge tool can check a hold flag got cleared before doing a merge.

@beldmit
Copy link
Member

beldmit commented Aug 11, 2025

It can. But I use a quite old version of this tool, and don't plan an update

@Sashan
Copy link
Contributor Author

Sashan commented Aug 11, 2025

It can. But I use a quite old version of this tool, and don't plan an update

I see. so perhaps we should add a commit/push hook to repository scripts. so it will avoid merging the stuff with unresolved holds (or not enough reviews).

@paulidale
Copy link
Contributor

Better might be preventing merge for any hold label, not just a committer hold.

@mattcaswell
Copy link
Member

I see. so perhaps we should add a commit/push hook to repository scripts. so it will avoid merging the stuff with unresolved holds (or not enough reviews).

This would be better. I do not use ghmerge

Copy link
Member

@t8m t8m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this is better than nothing.

BTW, I would like to know why people do not use ghmerge. It works very well.

rtm_set=1
if (l["name"] == "severity: urgent"):
urgent_set=1
if (l["name"] == "hold: committer discussion"):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please check all hold: * labels?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ping @Sashan

@Sashan
Copy link
Contributor Author

Sashan commented Oct 2, 2025

I tested the change using this simple shell snippet:

#! /usr/bin/env bash

WHAT='openssl'
PRNUM=$1

PR_URL_CONTENTS=$(mktemp /tmp/gh.XXXXXX)
PR_API=repos/openssl/$WHAT/pulls/$PRNUM
PR_URL=https://api.github.com/$PR_API
if which gh >/dev/null 2>&1 ; then
    if ! gh api $PR_API >$PR_URL_CONTENTS; then
        echo "Error getting $PR_API"
        exit 1
    fi
else
    if ! wget --quiet $PR_URL -O $PR_URL_CONTENTS; then
        echo "Error getting $PR_URL"
        exit 1
    fi
fi

set -- $(jq -r '[.head.user.login, .head.ref, .head.repo.ssh_url] | join(" ")' $PR_URL_CONTENTS)

TARGET_REPO=$(jq -r '.base.repo.name' $PR_URL_CONTENTS)
RTM_LABEL=$(jq -r '.labels[] | select(.name == "approval: ready to merge") | .name' $PR_URL_CONTENTS)
URGENT_LABEL=$(jq -r '.labels[] | select(.name == "severity: urgent") | .name' $PR_URL_CONTENTS)
HOLD_LABEL=$(jq -r '.labels[] | select(.name|test("hold*")) | .name' $PR_URL_CONTENTS)

echo "Hold Label: $HOLD_LABEL"
if [ "$TARGET_REPO" != "openssl" ]
then
    >&2 echo "Skipping ready to merge check for non-openssl repo"
elif [ -z "$RTM_LABEL" -a -z "$URGENT_LABEL" ]
then
    >&2 echo "This PR has neither the ready to merge or urgent label set, can't merge"
    exit 1
elif [ -n "$HOLD_LABEL" ] 
then
    >&2 echo "This PR has hold label, can't merge"
    exit 1
fi

echo "you are good to go with pr $PRNUM"
exit 0

I took pr 28691 which has a hold label

lifty$ ./test.sh 28691        
Hold Label: hold: committer discussion
This PR has neither the ready to merge or urgent label set, can't merge

and PR 28726 which has no hold label

lifty$ ./test.sh 28726 
Hold Label: 
This PR has neither the ready to merge or urgent label set, can't merge

Sashan added a commit that referenced this pull request Oct 6, 2025
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from #225)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants