-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Describe the feature you'd like to request
I am trying to integrate turborepo in my GitHub actions workflow.
I want to avoid checking out the entire history, so I tried to only check out two commits: the base commit and the merge commit of the pull request. Then I want to use --since=[base-commit] to only rebuild what has been affected by the request.
However, this will result in a fatal error due to these lines:
turborepo/cli/internal/scm/git.go
Lines 74 to 84 in 23cb6c1
| if fromCommit != "" { | |
| // Grab the diff from the merge-base to HEAD using ... syntax. This ensures we have just | |
| // the changes that have occurred on the current branch. | |
| command = []string{"diff", "--name-only", fromCommit + "...HEAD"} | |
| out, err = exec.Command("git", append(command, relSuffix...)...).CombinedOutput() | |
| if err != nil { | |
| log.Fatalf("unable to check diff vs. %s: %s", fromCommit, err) | |
| } | |
| committedChanges := strings.Split(string(out), "\n") | |
| files = append(files, committedChanges...) | |
| } |
Example of failed run: https://github.com/SamChou19815/infra/pull/25
When using three dots, git will try to find the mergebase between the two commits, which usually does not exist when you only checkout two isolated commits. I would like to support the use case so I don't have to checkout the entire history just for an incremental build from turborepo.
Describe the solution you'd like
An option that runs git diff --name-only fromCommit..HEAD under the hood would be great.
Describe alternatives you've considered
Use build cache instead?