Skip to content

Commit

Permalink
Support semver suffixes
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasleplus committed Dec 20, 2024
1 parent ecdad15 commit 860e12d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: "Dependabot auto-merge"
on: pull_request

permissions:
actions: write
contents: write
pull-requests: write

Expand All @@ -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:
Expand Down

0 comments on commit 860e12d

Please sign in to comment.