Skip to content

approve-bot-pr

approve-bot-pr #33

Workflow file for this run

name: Auto-Merge
on:
repository_dispatch:
types:
- approve-bot-pr
jobs:
automerge:
name: Merge or Rebase
if: ${{ github.event.client_payload.login == 'cf-buildpacks-eng' || github.event.client_payload.login == 'dependabot[bot]' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Fetch Pull Request Details
id: pull_request
env:
NUMBER: ${{ github.event.client_payload.number }}
GITHUB_TOKEN: ${{ secrets.CF_BOT_GITHUB_TOKEN }}
run: |
payload="$(
curl "https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${NUMBER}" \
--silent \
--location \
--header "Authorization: token ${GITHUB_TOKEN}"
)"
echo "::set-output name=mergeable_state::$(echo "${payload}" | jq -r -c .mergeable_state)"
- 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:
token: ${{ secrets.CF_BOT_GITHUB_TOKEN }}
number: ${{ github.event.client_payload.number }}
- name: Rebase
if: ${{ steps.pull_request.outputs.mergeable_state == 'behind' }}
uses: paketo-buildpacks/github-config/actions/pull-request/rebase@main
with:
token: ${{ secrets.CF_BOT_GITHUB_TOKEN }}
number: ${{ github.event.client_payload.number }}