fix!: use local git command to resolve existing commits instead of GitHub API#214
Open
mauriziovitale wants to merge 1 commit intonrwl:mainfrom
Open
fix!: use local git command to resolve existing commits instead of GitHub API#214mauriziovitale wants to merge 1 commit intonrwl:mainfrom
mauriziovitale wants to merge 1 commit intonrwl:mainfrom
Conversation
Contributor
|
Hi @mauriziovitale, Thank you for the PR. The proposed change looks solid.
Thank you! |
JamesHenry
requested changes
Mar 26, 2026
| process.stdout.write(`WARNING: Working directory '${workingDirectory}' doesn't exist.\n`); | ||
| } | ||
| } | ||
|
|
Contributor
There was a problem hiding this comment.
I think it would be worth failing fast on shallow clones here. This change you are making fully relies on local history being complete enough for git merge-base --is-ancestor to be meaningful, and with a shallow checkout the action can otherwise fall through into “no previous successful workflow” behavior instead of surfacing the real configuration problem.
Something along these lines would make the failure mode much clearer:
const isShallow = spawnSync('git', ['rev-parse', '--is-shallow-repository'], {
encoding: 'utf-8',
});
if (isShallow.stdout?.trim() === 'true') {
core.setFailed(
'Shallow clone detected. nx-set-shas requires fetch-depth: 0 to work correctly. ' +
'We also recommend filter: tree:0 to reduce checkout size. ' +
'See https://github.com/nrwl/nx-set-shas for the recommended checkout configuration.',
);
return;
}
Contributor
There was a problem hiding this comment.
NOTE: This is in addition to @meeroslav review notes above, those are also needed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: Replace the API call with git merge-base --is-ancestor, which is local, O(1), and has no depth limit.
Fixes #144