Skip to content
Latchkey

peter-evans/create-pull-request: Open PRs from CI

create-pull-request commits changes your workflow made and opens (or updates) a PR for them.

Use it for automated formatting, dependency bumps, or generated code. It detects the working-tree changes, commits them to a branch, and manages the PR.

Key inputs (with:)

  • token: token with PR permissions (often GITHUB_TOKEN).
  • commit-message: the commit message.
  • branch: the PR head branch to create or update.
  • title / body: PR metadata.
  • labels / reviewers: apply on creation.

Example workflow

.github/workflows/ci.yml
jobs:
  format:
    runs-on: ubuntu-latest
    permissions:
      contents: write
      pull-requests: write
    steps:
      - uses: actions/checkout@v4
      - run: npm run format
      - uses: peter-evans/create-pull-request@v7
        with:
          commit-message: 'style: auto-format'
          branch: chore/auto-format
          title: 'Auto-format code'

On any runner

This action runs on any runner. Latchkey managed runners run it unchanged.

Key takeaways

  • It commits existing working-tree changes, then opens the PR.
  • Needs contents: write and pull-requests: write.
  • Re-runs update the same branch and PR.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →