From 3d9f151cecb8e01416cca3310b897da7fad20bd8 Mon Sep 17 00:00:00 2001 From: Thomas Leplus Date: Fri, 20 Dec 2024 08:21:34 +0800 Subject: [PATCH] Support semver suffixes --- .github/workflows/automerge.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 1b3b21d..b4f656c 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -3,6 +3,7 @@ name: "Dependabot auto-merge" on: pull_request permissions: + actions: write contents: write pull-requests: write @@ -21,11 +22,14 @@ jobs: # Checking the PR title is a poor substitute for the actual PR changes # but as long as this is used only with dependabot PRs, # it should be safe to assume that the title is not misleading. - regexp='^Bump .* from [0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)? to [0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?( in .*)?$' - if [[ "${PR_TITLE}" =~ $regexp ]]; then - gh pr review --approve "${PR_URL}" + regexp='^Bump .* from [0-9]+\.[0-9]+(\.[0-9]+)?(\.[0-9]+)?(\-[a-z]+)? to [0-9]+\.[0-9]+(\.[0-9]+)?(\.[0-9]+)?(\-[a-z]+)?( in .*)?$' + if ! [[ "${PR_TITLE}" =~ ${regexp} ]] ; then + echo 'Non-semver upgrade, needs manual review.' + elif [ "${BASH_REMATCH[3]}" != "${BASH_REMATCH[6]}" ] ; then + echo 'Version suffixes do not match, needs manual review.' else - echo 'Non-semver upgrade needs manual review' + echo 'Automated review approval.' + gh pr review --approve "${PR_URL}" fi gh pr merge --auto --squash "${PR_URL}" env: