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@v8Inputs
| Name | Required | Default | Description |
|---|---|---|---|
token | No | ${{ github.token }} | The token that the action will use to create and update the pull request. |
branch-token | No | none | The token that the action will use to create and update the branch. Defaults to the value of `token`. |
path | No | none | Relative path under $GITHUB_WORKSPACE to the repository. Defaults to $GITHUB_WORKSPACE. |
add-paths | No | none | A 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-message | No | [create-pull-request] automated change | The message to use when committing changes. |
committer | No | github-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. |
author | No | ${{ 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. |
signoff | No | false | Add `Signed-off-by` line by the committer at the end of the commit log message. |
branch | No | create-pull-request/patch | The pull request branch name. |
delete-branch | No | false | Delete the `branch` if it doesn't have an active pull request associated with it. |
branch-suffix | No | none | The branch suffix type when using the alternative branching strategy. |
base | No | none | The pull request base branch. Defaults to the branch checked out in the workflow. |
push-to-fork | No | none | A 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-commits | No | false | Sign commits as `github-actions[bot]` when using `GITHUB_TOKEN`, or your own bot when using GitHub App tokens. |
title | No | Changes by create-pull-request action | The title of the pull request. |
body | No | Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action | The body of the pull request. |
body-path | No | none | The path to a file containing the pull request body. Takes precedence over `body`. |
labels | No | none | A comma or newline separated list of labels. |
assignees | No | none | A comma or newline separated list of assignees (GitHub usernames). |
reviewers | No | none | A comma or newline separated list of reviewers (GitHub usernames) to request a review from. |
team-reviewers | No | none | A 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. |
milestone | No | none | The number of the milestone to associate the pull request with. |
draft | No | false | Create a draft pull request. Valid values are `true` (only on create), `always-true` (on create and update), and `false`. |
maintainer-can-modify | No | true | Indicates whether maintainers can modify the pull request. |
Outputs
| Name | Description |
|---|---|
pull-request-number | The pull request number |
pull-request-url | The URL of the pull request. |
pull-request-operation | The pull request operation performed by the action, `created`, `updated` or `closed`. |
pull-request-head-sha | The commit SHA of the pull request branch. |
pull-request-branch | The 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.