Skip to content

[DNM] feat(auto-merge): rewrite to check PR title with regex - bump foo from 1.0.0 to 1.0.1 #272

[DNM] feat(auto-merge): rewrite to check PR title with regex - bump foo from 1.0.0 to 1.0.1

[DNM] feat(auto-merge): rewrite to check PR title with regex - bump foo from 1.0.0 to 1.0.1 #272

Workflow file for this run

name: auto-merge
on:
pull_request:
#pull_request_target:
branches:
- main
jobs:
auto-merge:
runs-on: ubuntu-latest
#if: github.actor == 'dependabot[bot]'
steps:
- name: Check eligibility
id: check
run: |
PR_TITLE="${{ github.event.pull_request.title }}"
PATTERN="bump (?:.*) from (?:[1-9]|(0[.][0-9]+)[.](?:[^ ]+) to \1[.])"
if [[ "$PR_TITLE" =~ $PATTERN ]]; then
echo "eligible=true" >> $GITHUB_OUTPUT
else
echo "eligible=false" >> $GITHUB_OUTPUT
fi
- uses: actions/github-script@v7
if: steps.check.outputs.eligible == 'true'
with:
github-token: ${{ secrets.AUTOMERGE_TOKEN }}
script: |
github.rest.pulls.createComment({
issue_number: context.payload.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '@dependabot squash and merge'
})