diff --git a/cmd/lint.go b/cmd/lint.go index 6dd252f..a0c564f 100644 --- a/cmd/lint.go +++ b/cmd/lint.go @@ -94,7 +94,26 @@ func updateWorkdir(ctx context.Context, dir string, cloneURL string) error { err = wtree.Pull(&git.PullOptions{Force: true}) if err != nil && !errors.Is(err, git.NoErrAlreadyUpToDate) { - return err + if !errors.Is(err, git.ErrWorktreeNotClean) { + return err + } + + slog.Debug("Retry pull", "url", cloneURL) + + head, err := repo.Head() + if err != nil { + return err + } + + err = wtree.Checkout(&git.CheckoutOptions{Force: true, Branch: head.Name()}) + if err != nil { + return err + } + + err = wtree.Pull(&git.PullOptions{Force: true}) + if err != nil && !errors.Is(err, git.NoErrAlreadyUpToDate) { + return err + } } return nil diff --git a/releases/v0.1.21.md b/releases/v0.1.21.md new file mode 100644 index 0000000..98c346a --- /dev/null +++ b/releases/v0.1.21.md @@ -0,0 +1,9 @@ +k6registry `v0.1.21` is here 🎉! + +This is an internal maintenance release. + +**Retry git pull on error** + +In the git working directory, the file permissions are changed to make the cache persistent in GitHub action mode. As a consequence, the git pull operation will fail (if permissions have actually been changed). + +To fix this, if the pull operation fails, the pull operation is repeated after a forced checkout operation.