Skip to content

fix: cherry-pick DCO check fails due to author email mismatch from squash merge #1072

@rnetser

Description

@rnetser

Problem

When the webhook server cherry-picks a squash-merged commit, the DCO check on the cherry-pick PR fails because:

  1. GitHub squash-merge rewrites the commit author email to the noreply format (e.g., 86722603+user@users.noreply.github.com)
  2. The Signed-off-by trailer preserves the original email (e.g., user@redhat.com)
  3. git cherry-pick replays the commit with the mismatched emails
  4. The DCO app checks that Signed-off-by email matches the commit author email → fails

This requires manual sign-off approval for every cherry-picked PR.

Root Cause

GitHub's squash-merge changes the commit author identity from the real email to the GitHub noreply format, but preserves the original Signed-off-by trailer verbatim. The cherry-pick faithfully reproduces this mismatch.

Solution

Add _restore_original_author_for_cherry_pick() to runner_handler.py that:

  • Extracts the Signed-off-by trailer from the cherry-picked commit message
  • Compares the sign-off email against the current commit author email
  • If they differ, amends the commit author to match the sign-off (restoring the original PR owner's identity)
  • Called after successful cherry-pick (clean or AI-resolved) before push

Deliverables

  • Add _restore_original_author_for_cherry_pick() method to RunnerHandler
  • Call it in cherry_pick() before push
  • Add unit tests (7 tests covering all paths)
  • Pass all reviewers (quality, guidelines, security, Cursor peer review)
  • All tests pass (1538 tests, 90.43% coverage)

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions