peter-evans/create-pull-request@v8

Creates a pull request for changes to your repository in the actions workspace

At a glance

Latest major
v8
Repository
peter-evans/create-pull-request
Inputs
24 (0 required)
Outputs
5
Runs using
node24
License
MIT
Last checked

Inputs and outputs come straight from the action's official action.yml. See our editorial standards.

Usage

- uses: peter-evans/create-pull-request@v8

Inputs

NameRequiredDefaultDescription
tokenNo${{ github.token }}The token that the action will use to create and update the pull request.
branch-tokenNononeThe token that the action will use to create and update the branch. Defaults to the value of `token`.
pathNononeRelative path under $GITHUB_WORKSPACE to the repository. Defaults to $GITHUB_WORKSPACE.
add-pathsNononeA comma or newline-separated list of file paths to commit. Paths should follow git's pathspec syntax. Defaults to adding all new and modified files.
commit-messageNo[create-pull-request] automated changeThe message to use when committing changes.
committerNogithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>The committer name and email address in the format `Display Name <[email protected]>`. Defaults to the GitHub Actions bot user.
authorNo${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>The author name and email address in the format `Display Name <[email protected]>`. Defaults to the user who triggered the workflow run.
signoffNofalseAdd `Signed-off-by` line by the committer at the end of the commit log message.
branchNocreate-pull-request/patchThe pull request branch name.
delete-branchNofalseDelete the `branch` if it doesn't have an active pull request associated with it.
branch-suffixNononeThe branch suffix type when using the alternative branching strategy.
baseNononeThe pull request base branch. Defaults to the branch checked out in the workflow.
push-to-forkNononeA fork of the checked out parent repository to which the pull request branch will be pushed. e.g. `owner/repo-fork`. The pull request will be created to merge the fork's branch into the parent's base.
sign-commitsNofalseSign commits as `github-actions[bot]` when using `GITHUB_TOKEN`, or your own bot when using GitHub App tokens.
titleNoChanges by create-pull-request actionThe title of the pull request.
bodyNoAutomated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub actionThe body of the pull request.
body-pathNononeThe path to a file containing the pull request body. Takes precedence over `body`.
labelsNononeA comma or newline separated list of labels.
assigneesNononeA comma or newline separated list of assignees (GitHub usernames).
reviewersNononeA comma or newline separated list of reviewers (GitHub usernames) to request a review from.
team-reviewersNononeA comma or newline separated list of GitHub teams to request a review from. Note that a `repo` scoped Personal Access Token (PAT) may be required.
milestoneNononeThe number of the milestone to associate the pull request with.
draftNofalseCreate a draft pull request. Valid values are `true` (only on create), `always-true` (on create and update), and `false`.
maintainer-can-modifyNotrueIndicates whether maintainers can modify the pull request.

Outputs

NameDescription
pull-request-numberThe pull request number
pull-request-urlThe URL of the pull request.
pull-request-operationThe pull request operation performed by the action, `created`, `updated` or `closed`.
pull-request-head-shaThe commit SHA of the pull request branch.
pull-request-branchThe pull request branch name

Read an output with ${{ steps.<step-id>.outputs.<name> }}; the step needs an id.

Examples

Open a pull request from a workflow

Commit generated changes to a branch and open (or update) one PR for them.

name: Example
on:
  push:
    branches: [main]

permissions:
  contents: write
  pull-requests: write

jobs:
  example:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - name: Generate a file
        run: date > updated.txt
      - name: Create Pull Request
        id: cpr
        uses: peter-evans/create-pull-request@v8
        with:
          branch: automation/update-files
          title: Update generated files
          commit-message: "chore: update generated files"
          delete-branch: true
      - name: Use the output
        run: echo "pull-request-number = ${{ steps.cpr.outputs.pull-request-number }}"

Each example passed actionlint (syntax, expressions and the inputs it knows for this action). They were not run in a live repository, so replace placeholder values such as names, ARNs and paths with your own.

Something out of date or wrong? Report it on our Contact page. This page is rebuilt from the action's repository roughly once a week.