Three GitHub steps work with pull requests. GitHub · Create a pull request — Asks to merge one branch into another. GitHub · Merge a pull request — Merges a pull request. GitHub · Get a pull request — A pull request's state, branches and whether it can merge. To comment on a pull request, use Add a comment — see Create, update or find GitHub issues.

Who can do this

Workspace Admins and Editors, on every plan. Viewers see the steps' settings but cannot change them.

Before you start

A GitHub connection whose token has the repository and Pull requests: Read and write — and for merging, Contents: Read and write too (classic: repo). See Connect GitHub.

Steps

Create a pull request:

  1. Select + where the step should go. In the step picker, open Apps, select GitHub, then Create a pull request. Or search GitHub.
  2. In Connection, choose your GitHub connection.
  3. In Repository, choose the repository — for example consulace/billing-service.
  4. In From branch, choose the branch with the changes — for example feature/gst-rounding. The list reads Loading your branches… first.
  5. In Into branch, choose the branch to merge into — for example main.
  6. In Title, type the title.
  7. Optional: in Body, the description.
  8. Optional: switch on Draft to open it as a draft. It is off unless you switch it on.
  9. Select Run this step to try it. This opens a real pull request.

Merge a pull request:

  1. In the step picker, under GitHub, select Merge a pull request, and choose the Connection and Repository.
  2. In Number, the pull request's number — 42, or {{ trigger.number }}.
  3. In How, choose Merge commit, Squash or Rebase. Merge commit is chosen to begin with.
  4. Optional: in Commit title, the title of the merge or squash commit. Empty uses GitHub's own.
  5. Select Run this step to try it. This merges for real.

Get a pull request:

  1. In the step picker, under GitHub, select Get a pull request, and choose the Connection and Repository.
  2. In Number, the pull request's number.
  3. Select Run this step to try it.

Output

Create a pull request and Get a pull request give the pull request:

Field What it is
number Its number — what Merge a pull request and Add a comment take.
title, body Its title and description.
state open or closed.
url Its page on GitHub.
head, base The branch it comes from and the branch it goes into.
draft true for a draft.
merged true once merged.
mergeable true when GitHub can merge it, false when there are conflicts, empty while GitHub is still working it out.
author The username of whoever opened it.

Merge a pull request gives merged (true), sha — the commit the merge made — and message, GitHub's own words such as Pull Request successfully merged.

Good to know

  • mergeable may be empty straight after a pull request is created or its branch changes. Get it again a little later — add a Wait step first — for a firm answer.
  • Merging follows the repository's rules. Required reviews, required checks and allowed merge methods set in GitHub still apply; GitHub refuses a merge they forbid.
  • Each item runs the step once. Ten items open ten pull requests.

If something goes wrong

What you see Why What to do
GitHub refused: Validation Failed — A pull request already exists for consulace:feature/gst-rounding. That branch already has an open pull request into the same branch. Use the existing one, or close it first.
GitHub refused: Validation Failed — No commits between main and feature/gst-rounding. The branch has nothing the other lacks. Check the branches are the right way round.
GitHub refused: Pull Request is not mergeable. Conflicts, or the pull request is already closed. Resolve the conflicts in GitHub.
GitHub refused: Squash merges are not allowed on this repository. (or the same for merge commits or rebase) The repository does not allow that method. Choose a method the repository allows in How.
GitHub refused: … Required status check … is expected. / … review is required … The branch's protection rules are not met yet. Wait for the checks or the review, then merge.
Number is not an issue or pull request number. Number is not a whole number. Give a number such as 42.
GitHub refused: Not Found. No pull request with that number, or the token cannot see the repository. Check the number and the token's repositories.