platformsh / gha-create-autopr

Creates Auto-Merging Pull Requests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create Auto-Merge Pull Request

If your GitHub repository is set up to support auto-merging of pull requests, this GitHub Action will create a pull request and then set the pull request to auto-merge after all checks have completed successfully.

Inputs

  • repo-owner - Owner/namespace of the target repository. Defaults to github.repository_owner from the github context.
  • repo-name - Target repository name. Defaults to github.event.repository.name from the from the github context.
  • github-token - Github personal access token with access rights to the target repository so we can work with the github api. REQUIRED.
  • trigger-source - The action that triggered this pull request creation. This is used to generate the Pull Request title and body message. REQUIRED.
  • merge-branch - The branch you are want to merge. Defaults to the branch listed in GITHUB_REF
  • default-branch - The default branch for this repository (aka the branch you want to merge into). If you used platformsh/prep-for-autopr action, then this is the output from that action. REQUIRED.
  • delete-branch-after-merge - Should the target branch be deleted after successful merge? yes|No. Defaults to no. Maps directly to the --delete-branch parameter of the gh pr merge command.

Outputs

There are no outputs for this action.

Example usage:

See Create & merge PR step below

name: Trigger Auto PR on push to update branch
on:
    push:
        branches:
            - update

env:
    GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

jobs:
    create-auto-pr:
        name: "Creates an auto merging PR when the branch is updated"
        runs-on: ubuntu-latest
        steps:
            - name: 'Prep the repo for autoPR'
              id: prepautopr
              uses: platformsh/prep-for-autopr@main
              with:
                github-token: ${{ secrets.GITHUB_TOKEN }}
            - name: 'Create & merge PR'
              id: create-merge-pr
              uses: platformsh/create-pr@main
              with:
                  github-token: ${{ secrets.GITHUB_TOKEN }}
                  trigger-source: 'auto push'
                  default-branch: ${{ steps.prepautopr.outputs.default-branch }}

About

Creates Auto-Merging Pull Requests