Skip to main content
← Back to workflows

How to Create a Pull Request with GitHub Actions?

peter-evans/create-pull-request -
GitHub Action
Create Pull Request v6.0.5
2,116
Contributors
Contributor - peter-evans
Categories
CICUBE ANALYTICS INSIGHTS
Engineering Velocity: 25% Team Time Lost to CI Issues
View Platform →
3.5h
Time Saved/Dev/Week
40%
Faster Releases
Click for next insight
Usage
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6

create-pull-request logo

create-pull-request

A GitHub action to create a pull request for changes to your repository in the actions workspace


Create Pull Request GitHub action is very handy to automate the creation of pull requests in the workflow of our projects directly on GitHub.

Basically, the action monitors all changes made to the repository conducted during the session of workflow. These include newly spotted files, existing files modifications, and commits performed but not yet pushed. Once it detects such a change, they automatically get committed on either a new branch or on the existing one.

It ensures that there is a pull request into the base branch we have been working from in the current workflow, requesting a merge to the new branch.

Here is why we think it is useful:

Automation: Automation of some of the repetitive job types, like creating a pull request for every small change during a workflow. All this only to smoothen and make our development process a bit quicker.

  • Efficiency: It ensures no changes within a workflow are lost, and all are well documented via pull requests. Integration: It will easily integrate with other GitHub actions we may be using for modification or addition of files to make the workflow look integrated. Generally, it has made this very productive for keeping up with a streamlined, automated workflow, especially where we do have many changes that need regular review and merge processes.

How to use commit-message input in GitHub Actions

To utilize the commit-message input effectively in your GitHub Actions workflow, follow these steps:

  1. Begin with the commit-message field, which serves to provide a concise message for your commit. Ensure the first line clearly conveys the essence of the commit.
commit-message: |
the first line is the commit message
  1. After the commit message, leave a single blank line before starting the commit description. This description elaborates further on the changes introduced in the commit and can span multiple lines.
commit-message: |
the first line is the commit message

the commit description starts
after a blank line and can be
multiple lines

How to enable delete-branch feature?

The delete-branch feature facilitates automatic branch deletion under certain conditions. Here's how to enable and understand its behavior:

  • This feature doesn't immediately delete branches upon merge due to technical limitations.
  • When activated, it will delete branches during the next action run if there's no further diff.
  • It aids in cleaning up merged branches, ensuring a tidy repository.

How to add Proxy support for self-hosted runners

For GitHub Actions workflows running on self-hosted runners behind corporate proxies, ensure proper proxy support by setting the https_proxy environment variable:

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
env:
https_proxy: http://<proxy_address>:<port>

This ensures seamless workflow execution even in environments with proxy requirements.