Skip to content

pr-force-pushes

Included in config: 🔒 strict

Force-pushing a pull request rewrites its history. Once a pull request has been reviewed, rewritten history makes it harder for reviewers to see what changed since their last review.

This rule reports when a pull request’s latest commit was force-pushed by its author after the pull request was first reviewed. Reviews from bots, such as automatic Copilot reviews, and from the pull request’s author don’t count. Force-pushes by anyone other than the author, such as maintainers or stacking tool bots, are ignored.

Many repositories squash merge pull requests, so there’s no need to keep a pull request’s commits clean. Pushing new commits on top of existing ones keeps each review’s changes easy to find. To bring in changes from the base branch, such as to resolve merge conflicts, merge the base branch in instead of rebasing onto it.

This rule intentionally does not report on draft PRs. If you wish to present a clear Git history before peer reviews, consider force pushing while the PR is still in draft

github-actions
👋 Hi @YourUsername, thanks for the issue! A scan flagged a concern with it. Could you please take a look?

[pr-force-pushes]

This pull request’s latest changes were force-pushed after it was reviewed. This repository asks that pull requests not be force-pushed after they’ve been reviewed. Rewriting a pull request’s history makes it harder for reviewers to see what changed between reviews. To resolve this report, push any further changes as new commits rather than force-pushing. There’s no need to rewrite existing commits to keep them clean. If you need to resolve conflicts, merge the base branch in instead of rebasing onto it.

Each snippet in this section shows changes to the full .github/workflows/octoguide.yml workflow from Get Started.

This rule is included in the strict config, which isn't enabled by default. To add it to the rules your workflow already runs, enable it in rules:

.github/workflows/octoguide.yml
jobs:
octoguide:
runs-on: ubuntu-latest
steps:
- uses: OctoGuide/bot@0.29.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
rules: |
{
"pr-force-pushes": true
}

Alternatively, switch to the strict config to enable this rule along with every other strict rule:

.github/workflows/octoguide.yml
jobs:
octoguide:
runs-on: ubuntu-latest
steps:
- uses: OctoGuide/bot@0.29.1
with:
config: strict
github-token: ${{ secrets.GITHUB_TOKEN }}

To use this rule on its own, enable it in rules with the none config:

.github/workflows/octoguide.yml
jobs:
octoguide:
runs-on: ubuntu-latest
steps:
- uses: OctoGuide/bot@0.29.1
with:
config: none
github-token: ${{ secrets.GITHUB_TOKEN }}
rules: |
{
"pr-force-pushes": true
}