-
Notifications
You must be signed in to change notification settings - Fork 82
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 NX_BASE SHA for merge_group event #145
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.
find-successful-workflow.ts
Outdated
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 |
We had to fork to pull in this patch (it's working great for us), it would be nice to get it integrated into the real action at some point soon. |
Hey everyone! Sorry for the delay in getting a review on this. We've all been super swamped on other initiatives. Luckily I'm hoping to take a look at this soon |
Looks good to me, thank you! |
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.Fixes #140