Skip to content

[ci] Auto-resolve predictable PR conflicts#237

Merged
coisa merged 3 commits intomainfrom
fix/192-auto-resolve-predictable-conflicts
Apr 24, 2026
Merged

[ci] Auto-resolve predictable PR conflicts#237
coisa merged 3 commits intomainfrom
fix/192-auto-resolve-predictable-conflicts

Conversation

@coisa
Copy link
Copy Markdown
Contributor

@coisa coisa commented Apr 24, 2026

Related Issue

Closes #192

Motivation / Context

  • PR branches have repeatedly become unmergeable only because main moved a workflow-managed .github/wiki pointer or because CHANGELOG.md gained adjacent Unreleased entries.
  • The changelog resolver treats the current base branch changelog as authoritative and replays branch-only Unreleased entries into the active Unreleased section, so release promotion on main does not cause new branch notes to land under the wrong published version.

Changes

  • Add a reusable auto-resolve-conflicts.yml workflow plus packaged consumer wrapper.
  • Add a local github/resolve-predictable-conflicts action that scans same-repository PRs, attempts a local merge, and only pushes a resolution when conflicts are limited to .github/wiki and/or CHANGELOG.md.
  • Add UnreleasedChangelogConflictResolver with tests covering normal drift, release-moved base state, and deduplication.
  • Document the predictable-conflict workflow in GitHub Actions and branch-protection docs.
  • Include small Rector-required cleanup in existing config tests so the refactor gate stays green.

Verification

  • composer dev-tools (timed out after 300s during metrics; before timeout it reported full PHPUnit success: 519 tests, 1600 assertions, and only the Rector findings that are now fixed)
  • composer dev-tools refactor -- --json
  • composer dev-tools code-style -- --json
  • composer dev-tools phpdoc -- --json
  • composer dev-tools docs -- --json
  • composer dev-tools changelog:check
  • composer dev-tools tests -- --filter=Changelog
  • composer dev-tools tests -- --filter='Changelog|ComposerDependencyAnalyserConfigTest|ECSConfigTest'
  • php -l .github/actions/github/resolve-predictable-conflicts/resolve-changelog.php && bash -n .github/actions/github/resolve-predictable-conflicts/run.sh
  • YAML parsed with Ruby YAML.load_file for the new workflow/action files
  • Manual changelog-conflict simulation confirmed branch-only entries stay in the current Unreleased after base release promotion

Documentation / Generated Output

  • README updated
  • docs/ updated
  • Generated or synchronized output reviewed

Changelog

  • Added a notable CHANGELOG.md entry

Reviewer Notes

  • The workflow remains intentionally conservative: fork PRs are skipped, already-mergeable PRs are skipped, and any conflict outside .github/wiki/CHANGELOG.md aborts back to manual resolution.
  • .github/wiki keeps the PR side because it represents the preview branch pointer for that PR.

Additional Review Validation

  • Synthetic local Git/GitHub harness exercised .github/actions/github/resolve-predictable-conflicts/run.sh end to end by:
    • creating a temporary repository with a real CHANGELOG.md merge conflict;
    • mocking gh pr view, gh workflow view, and gh workflow run;
    • rewriting the action clone to the temporary bare repository;
    • confirming the action pushed a resolution commit;
    • confirming the resolved changelog kept the branch-only entry in current Unreleased and kept the base release entry under 1.2.0;
    • confirming tests.yml dispatch was requested with publish-required-statuses=true.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 24, 2026

@coisa coisa merged commit e9f91cd into main Apr 24, 2026
32 checks passed
@coisa coisa deleted the fix/192-auto-resolve-predictable-conflicts branch April 24, 2026 18:19
@github-project-automation github-project-automation Bot moved this from Backlog to Released in PHP Fast Forward Project Apr 24, 2026
github-actions Bot added a commit that referenced this pull request Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request github-actions

Projects

Status: Released

Development

Successfully merging this pull request may close these issues.

[github-actions] Auto-resolve predictable PR conflicts for wiki pointer and changelog drift

1 participant