You can use query parameters to open pull requests. Query parameters are optional parts of a URL you can customize to share a specific web page view, such as search filter results or a pull request template on GitHub. To create your own query parameters, you must match the key and value pair.
Tip: You can also create pull request templates that open with default labels, assignees, and an pull request title. For more information, see "Using templates to encourage useful issues and pull requests."
You must have the proper permissions for any action to use the equivalent query parameter. For example, you must have permission to add a label to a pull request to use the labels
query parameter. For more information, see "Repository roles for an organization."
If you create an invalid URL using query parameters, or if you don’t have the proper permissions, the URL will return a 404 Not Found
error page. If you create a URL that exceeds the server limit, the URL will return a 414 URI Too Long
error page.
Query parameter | Example |
---|---|
quick_pull | https:/ creates a pull request that compares the base branch main and head branch my-branch . The quick_pull=1 query brings you directly to the "Open a pull request" page. |
title | https:/ creates a pull request with the label "bug" and title "Bug fix." |
body | https:/ creates a pull request with the title "Bug fix" and the comment "Describe the fix" in the pull request body. |
labels | https:/ creates a pull request with the labels "help wanted" and "bug". |
milestone | https:/ creates a pull request with the milestone "testing milestones." |
assignees | https:/ creates a pull request and assigns it to @octocat. |
projects | https:/ creates a pull request with the title "Bug fix" and adds it to the organization's project board 1. |
template | https:/ creates a pull request with a template in the pull request body. The template query parameter works with templates stored in a PULL_REQUEST_ subdirectory within the root, docs/ or .github/ directory in a repository. For more information, see "Using templates to encourage useful issues and pull requests." |