.github: add automerge script and workflow for upstream sync - #209
Conversation
848c3fb to
9dfe6b8
Compare
9dfe6b8 to
b709061
Compare
b709061 to
a281154
Compare
|
Updated to do a general FF -> conflict-free merge renaming. |
spatrang
left a comment
There was a problem hiding this comment.
Summary
Nice improvement — generic config, dry-run wiring, conflict-free naming, and enabling the workflow all look solid.
Action items before merge:
- Fix dry-run fall-through in §7b (bug)
- Confirm repo variables are configured
- Update tests/docs for renamed API (this PR or immediate follow-up)
Comments on files not changed in this PR
.github/scripts/test_automerge.py — renamed symbols
test_automerge.py still references removed/renamed APIs: find_open_ff_pr, open_ff_pr, push_master_mirror. Please update to find_open_conflict_free_pr, open_conflict_free_pr, and push_upstream_mirror in this PR or an immediate follow-up.
.github/scripts/test_automerge.py ~L203–221 — merge abort test expectation
test_cleanup_runs_even_when_abort_raises expects probe_clean_prefix to raise when merge --abort fails. This PR changed abort to check=False (automerge.py L378), so cleanup completes and the function returns instead of raising. Please update the test to assert cleanup still runs and (last_clean, first_conflict) is returned correctly.
.github/scripts/test_automerge.py ~L344–351 — missing dry-run regression test
TestDryRun.test_dry_run_partial_prefix_skips_push_and_pr mocks probe_result=("aaa", "bbb") but does not assert that conflict PR dry-run output is not printed. Once the §7b return is fixed, please add an assertion that only the conflict-free dry-run path runs for partial prefix.
.github/scripts/automerge.md — documentation out of date
Documentation still describes hardcoded amd-staging/master, "fast-forward" terminology, and old branch prefixes/constants. Please update to match configurable branches, conflict-free naming, dry-run, and required repo variables.
01cc268 to
cf2bd3f
Compare
spatrang
left a comment
There was a problem hiding this comment.
Second-round review
All first-round items are addressed. Unit tests pass (19 tests).
| First-round item | Status |
|---|---|
§7b dry-run missing return |
Fixed (L549) |
| Import-time env vars break tests | Fixed — _load_automerge() injects _TEST_ENV |
Tests still used old APIs (find_open_ff_pr, open_ff_pr, push_master_mirror) |
Fixed |
Abort test expected a raise after check=False |
Fixed — test_cleanup_runs_even_when_abort_fails asserts return values + cleanup |
| Dry-run partial-prefix missing conflict-path assertion | Fixed — mock_conflict_pr.assert_not_called() |
automerge.md out of date |
Fixed |
| Direct refspec push | Confirmed intentional |
Broad pull_request trigger |
Resolved by dropping the trigger; schedule + workflow_dispatch only |
| Repo variables must be set before merge | Confirmed (AUTOMERGE_TARGET_BRANCH=amd-staging, AUTOMERGE_UPSTREAM_BRANCH=master) |
Pre-merge reminder (not a code change): set those two repository variables before the scheduled job starts running.
LGTM.
5e0fee4 to
3c14c1f
Compare
938488b to
4905fd6
Compare
Adds automerge.py, which fetches ROCgdb upstream commits, probes them for merge conflicts against the target branch, and opens either a conflict-free PR or a conflict PR for manual resolution. Dry-run mode skips all pushes and PR creation. Also adds test_automerge.py with unit tests covering run(), run_net(), probe_clean_prefix(), find_open_conflict_pr/conflict_free_pr, early-exit gating, and dry-run behavior for all three outcome paths.
Schedules automerge.py to run every 6 hours and exposes a workflow_dispatch trigger with an optional dry-run input. The job uses repository variables AUTOMERGE_TARGET_BRANCH and AUTOMERGE_UPSTREAM_BRANCH so the target and upstream branches are configurable without touching the workflow file.
4905fd6 to
319a093
Compare
Summary
AUTOMERGE_TARGET_BRANCH,AUTOMERGE_UPSTREAM_BRANCH) instead of being hardcoded. The script exits with an error if any are unset.--dry-runmode: fetches and probes normally but skips all pushes and PR creation, printing what it would do instead (branch name, commit range, PR title, and conflicted files if applicable).--dry-runto a booleanworkflow_dispatchinput so it can be toggled from the Actions UI.if: falseguard and enable the schedule andworkflow_dispatchtriggers. Thepull_requesttrigger has been dropped in favour of relying solely on the 6-hour schedule.Repository variables required before merge
AUTOMERGE_TARGET_BRANCH— branch to merge into (e.g.amd-staging)AUTOMERGE_UPSTREAM_BRANCH— upstream branch to pull from (e.g.master)Test plan
origin/masteris updated and a conflict-free or conflict PR is openedpython3 -m pytest .github/scripts/test_automerge.py