Skip to content

Git automation logs GitHub's "Bypassed rule violations" push notice as an error #15524

Closed

Description

@illia-sapryga

Bug description

When main is protected by a GitHub ruleset and the Git automation pushes with a credential that is allowed to bypass it (a deploy key in the ruleset's bypass list), the push succeeds, but GitHub writes a notice to stderr:

remote: Bypassed rule violations for refs/heads/main:
remote:
remote: - Changes must be made through a pull request.
remote:
remote: - Required status check "…" is expected.

Statamic\Console\Processes\Git::prepareErrorOutput() already ignores similar GitHub notices (remote: Resolving deltas, remote: Processed, remote: GitHub found), but not this one, so every successful push is logged at error level. Error trackers (Laravel Nightwatch in our case) then report each content save as an error.

Expected: a push that succeeded isn't logged as an error.

How to reproduce

  1. Protect main with a GitHub ruleset that requires pull requests, and add a deploy key to its bypass list.
  2. Enable the Git automation with pushing, using that deploy key.
  3. Save an entry in the control panel. The commit reaches GitHub, and the log gets the error below.

Logs

production.ERROR: Process Class: Git
Command: 'git' 'push' '--porcelain'
Error: remote: Bypassed rule violations for refs/heads/main:
remote:
remote: - Changes must be made through a pull request.
remote:
remote: - Required status check "…" is expected.
remote:

Environment

Statamic 6.33.0 Pro, Laravel 13.32.0, PHP 8.5, Git automation with push enabled, GitHub organization rulesets.

Installation

Fresh statamic/statamic site via CLI

Additional details

Adding 'remote: Bypassed rule violations' to the $ignore list in src/Console/Processes/Git.php would cover the first line; the rule lines that follow may arrive in separate stderr chunks. A sturdier option might be to log a push's stderr only when the push exits with a non-zero code, since git push writes routine notices to stderr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions