Skip to content

feat: skip all CI checks and comment once when PR has merge conflicts #1208

Description

@rnetser

Problem

When a pushed PR has merge conflicts, the webhook server still queues and runs all CI checks (tox, pre-commit, container build, python module install, conventional-title, security checks, custom checks). Running CI against an unmergeable state wastes compute, and the author gets no clear signal that they need to resolve conflicts.

Behavior

  • On push/synchronize, determine conflict state via pull_request.mergeable is False (existing detection in label_pull_request_by_merge_state).
  • If the PR has conflicts:
    • Add the has-conflicts label (existing behavior).
    • Skip all CI checks — do not queue or run any of them.
    • Post a comment explaining why CI did not run and that resolving the conflicts (rebase/merge) will re-trigger checks on the next push.
  • Dedup via the has-conflicts label (no spam):
    • The first conflicting push adds the label (absent→present) → post the comment.
    • Subsequent conflicting pushes see the label already present → skip CI, no new comment.
  • When conflicts clear: the has-conflicts label is removed (existing behavior) and CI runs normally on the next push. If conflicts later reappear, the label was removed in between, so a fresh comment posts.

Done

  • process_opened_or_synchronize_pull_request skips all CI check queueing and runner tasks when pull_request.mergeable is False
  • has-conflicts label added on first conflicting push (existing transition logic reused)
  • Comment posted exactly once per conflict episode, gated on the has-conflicts label absent→present transition (present = already notified, no re-comment)
  • Comment text explains CI was skipped due to merge conflicts and that resolving them re-triggers checks
  • Unit tests: (a) conflicting push with no label → skips CI + adds label + comments; (b) conflicting push with label already present → skips CI, no new comment; (c) no-conflict push → CI runs normally
  • docs/ regenerated via docsfy (or deferred to a follow-up issue if docsfy is unavailable)

Assisted-by: PI (gpt-5.6-luna)

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions