Skip to content

.github: automerge: unshallow repo before merge-base - #311

Merged
lumachad merged 1 commit into
amd-stagingfrom
users/lumachad/amd-staging/automerge_v3
Aug 27, 2026
Merged

.github: automerge: unshallow repo before merge-base#311
lumachad merged 1 commit into
amd-stagingfrom
users/lumachad/amd-staging/automerge_v3

Conversation

@lumachad

Copy link
Copy Markdown
Collaborator

Problem

The automerge workflow uses actions/checkout with the default
fetch-depth: 1, producing a shallow clone. The script reuses that
repo (--repo $WORKSPACE), fetches full sourceware/master history,
then calls:

git merge-base origin/amd-staging sourceware/master

This fails with exit code 1 because the shallow clone does not contain
the common ancestor. Example failure:
https://github.com/ROCm/ROCgdb/actions/runs/33000292878/job/98280035701

Fix

After fetching origin/TARGET_BRANCH, check whether the repo is shallow
(git rev-parse --is-shallow-repository) and unshallow it if so. When
the script manages its own clone the repo is never shallow, so this is a
no-op on that path.

When the workflow uses actions/checkout with the default fetch-depth of 1,
the working repo is shallow.  Fetching sourceware/master brings in full
history, but git merge-base then fails with exit code 1 because the shallow
origin/amd-staging tip has no common ancestor reachable in its truncated
history.

Detect a shallow repository after fetching origin/TARGET_BRANCH and
immediately unshallow it so that the subsequent merge-base call can find
the common ancestor.  When the script manages its own clone the repo is
never shallow, so this path is a no-op there.
@lumachad lumachad self-assigned this Aug 27, 2026
@lumachad
lumachad marked this pull request as ready for review August 27, 2026 09:08
@lumachad
lumachad requested a review from a team as a code owner August 27, 2026 09:08
@lumachad

Copy link
Copy Markdown
Collaborator Author

Self-approving as it is parallel to CI and a simple fix.

@lumachad
lumachad merged commit 616045c into amd-staging Aug 27, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant