pr-branch-non-default
Included in configs: ✅ recommended, 🔒 strict
Sending a PR from a repository’s default branch, commonly main, means that repository will have a hard time pulling in updates from the upstream repository.
It’s generally recommended to instead create a new branch per pull request.
“Base” and “Head”
Section titled ““Base” and “Head””Two terms are useful to know when working with forked repositories and pull requests:
- “Base”: The main repository that receives the pull request.
- Your local Git clone likely refers to this as “upstream”.
- “Head”: Your fork that is sending the pull request.
- Your local Git clone likely refers to this as “origin”.
Suggested Steps
Section titled “Suggested Steps”GitHub does not provide a way to change the head branch of a pull request. You’ll want to:
- Create a new branch on the head repository
- Close the original pull request on GitHub
- Send a new pull request from that branch
Examples
Section titled “Examples”PR sent from a default main branch:
How to Enable
Section titled “How to Enable”Each snippet in this section shows changes to the full .github/workflows/octoguide.yml workflow from Get Started.
This rule is enabled by default as part of the recommended config.
To use this rule on its own, enable it in rules with the none config:
jobs: octoguide: runs-on: ubuntu-latest steps: - uses: OctoGuide/bot@0.26.4 with: config: none github-token: ${{ secrets.GITHUB_TOKEN }} rules: | { "pr-branch-non-default": true }
[pr-branch-non-default]
This PR is sent from the head repository’s default branch. Sending a PR from a default branch means the head repository can’t easily be updated after the PR is merged. Sending a PR from a repository’s default branch, commonly
main, means that repository will have a hard time pulling in updates from the upstream repository. It’s generally recommended to instead create a new branch per pull request. You’ll need to: