-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: return correct base_sha when merge_group event happens #145
base: main
Are you sure you want to change the base?
Conversation
Closed since I couldn't test enough scenarios |
return result ? result.at(1) : undefined; | ||
} | ||
|
||
async function findMergeQueueBranch(): Promise<string> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In merge-queue scenario, base will always be the previous commit in the queue. That's why we can remove these functions here.
const baseResult = spawnSync('git', ['merge-base', `origin/${mainBranchName}`, 'HEAD'], { encoding: 'utf-8' }); | ||
BASE_SHA = baseResult.stdout; | ||
} else if (eventName == "merge_group") { | ||
const baseResult = spawnSync('git', ['rev-parse', 'HEAD^1'], { encoding: 'utf-8' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In merge-queue scenario, base will always be the previous commit in the queue.
@mandarini would appreciate your review |
Context
As reported in #140, the current solution for merge-queue works only when the queue size 1. When more commits are added to the queue, the action keeps setting the same
NX_BASE
for all of them.Problem
When new commits are added to the queue, we expect the
NX_BASE
commit to be the last commit in the queue. However, it sets the last commit in master. This image from #140 (comment) represents well the problem.Solution proposed
The
NX_BASE
commit should be main branch HEAD commit when merge-queue has size 1. When size > 1,NX_BASE
should be the HEAD commit of the last merge branch that current commit is on top of.