Skip to content

Auto-Merge

Auto-Merge #455

Workflow file for this run

name: Auto-Merge
on:
pull_request_review:
types:
- submitted
jobs:
automerge:
name: Merge or Rebase
if: ${{ github.event.review.user.login == 'paketo-bot-reviewer' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Fetch Pull Request Details
id: pull_request
env:
NUMBER: ${{ github.event.pull_request.number }}
GITHUB_TOKEN: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
run: |
payload="$(
curl "https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${NUMBER}" \
--silent \
--location \
--header "Authorization: token ${GITHUB_TOKEN}"
)"
echo "mergeable_state=$(echo "${payload}" | jq -r -c .mergeable_state)" >> $GITHUB_OUTPUT
- name: Merge
if: ${{ steps.pull_request.outputs.mergeable_state == 'clean' || steps.pull_request.outputs.mergeable_state == 'unstable' }}
uses: paketo-buildpacks/github-config/actions/pull-request/merge@main
with:
user: paketo-bot
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
number: ${{ github.event.pull_request.number }}
- name: Rebase
if: ${{ steps.pull_request.outputs.mergeable_state == 'behind' }}
uses: paketo-buildpacks/github-config/actions/pull-request/rebase@main
with:
user: paketo-bot
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
number: ${{ github.event.pull_request.number }}