Skip to content
Latchkey

peter-evans/create-pull-request

Commit changes made during a workflow and open (or update) a pull request with them.

Community actionCategory: Pull Request AutomationLatest v7View on GitHub

What it does

peter-evans/create-pull-request commits any changes a job made to the working tree onto a branch and opens or updates a pull request, which is the standard way to automate dependency bumps, formatting, or generated files.

It only commits changes that already exist in the workspace; make your edits in earlier steps.

Usage

workflow (.yml)
permissions:
  contents: write
  pull-requests: write
steps:
  - uses: actions/checkout@v4
  - run: npm run format   # makes the changes
  - uses: peter-evans/create-pull-request@v7
    with:
      commit-message: 'style: apply formatting'
      title: 'Automated formatting'
      branch: automated/formatting

Inputs

InputDescriptionDefaultRequired
tokenToken to push and open the PR.GITHUB_TOKENNo
commit-messageCommit message for the changes.-No
titlePR title.-No
branchBranch to create for the PR.-No
baseBase branch to target.default branchNo
labelsLabels to add to the PR.-No

Outputs

OutputDescription
pull-request-numberNumber of the created/updated PR.
pull-request-urlURL of the PR.

Notes

PRs created with the default GITHUB_TOKEN do not trigger other workflows (to prevent loops). Use a PAT or app token if the PR must run CI.

Enable "Allow GitHub Actions to create and approve pull requests" in repo/org settings.

Common errors

  • GitHub Actions is not permitted to create or approve pull requests means the org/repo setting is disabled. Enable it.
  • A created PR that never runs CI is expected with GITHUB_TOKEN; switch to a PAT or app token.

Security and pinning

  • Pin to a commit SHA.
  • If you use a PAT to trigger downstream workflows, scope it tightly and store it as a secret.

Alternatives and related

Frequently asked questions

Why does my auto-created PR not run any checks?
PRs opened with the default GITHUB_TOKEN intentionally do not trigger workflows. Use a personal access token or a GitHub App token instead.
Running peter-evans/create-pull-request? Run it on Latchkey managed runners - self-healing and caching included. Start free → 30-day trial · No credit card