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
actions/github-script: Run JavaScript Against the GitHub APIReference for actions/github-script: run inline JavaScript with a pre-authenticated Octokit client to comment…
Dependabot: dependabot.yml Configuration ReferenceReference for dependabot.yml: configure automated dependency update PRs per ecosystem, including update sched…
actions/labeler: Auto-Label PRs by Changed PathsReference for actions/labeler: automatically apply labels to pull requests based on which files they touch, c…