Skip to content

Merge pull requests once ready #1932

Merge pull requests once ready

Merge pull requests once ready #1932

Workflow file for this run

name: Merge pull requests once ready
on:
check_suite:
types: [completed]
pull_request:
types: [labeled]
pull_request_review:
types: [submitted]
jobs:
build:
runs-on: ubuntu-latest
name: 'Merge pull requests'
steps:
- name: Find pull request
uses: iadvize/actions/[email protected]
# only useful for check_suite, we have a pull_request object on pull_request and pull_request_review
if: github.event_name == 'check_suite'
id: pr
with:
branch: ${{ github.event.check_suite.head_branch }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: 'Merge the current pull request if possible'
uses: iadvize/actions/[email protected]
if: >
github.event_name != 'check_suite' || (
github.event_name == 'check_suite'
&& github.event.check_suite.head_branch != 'master'
&& github.event.check_suite.conclusion == 'success'
&& steps.pr.outputs.pullExists == 'true'
)
with:
# we use another token here
# because an action in a workflow run can't trigger a new workflow run
# with the GITHUB_TOKEN
# @see https://help.github.com/en/articles/events-that-trigger-workflows#event-restrictions
token: ${{ secrets.GITHUB_TOKEN_REPO_WRITE }}
pullNumber: ${{ (github.event.pull_request && github.event.pull_request.number) || steps.pr.outputs.pullNumber }}
label: 'Action: keep-rebased-then-merge'