1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-17 20:47:50 +02:00

fix: move shallow clone error to warning

refs #2141 #2134

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
Carlos Alexandro Becker 2021-03-24 23:15:23 -03:00
parent d04a7dad19
commit be4049e6d8
4 changed files with 6 additions and 9 deletions

View File

@ -33,7 +33,3 @@ var ErrNotRepository = errors.New("current folder is not a git repository")
// ErrNoGit happens when git is not present in PATH.
var ErrNoGit = errors.New("git not present in PATH")
// ErrShallowClone happens when goreleaser runs against a shallow copy of a repo.
// You'll need to setup your clone step to clone the whole repo instead.
var ErrShallowClone = errors.New("refusing to run against a shallow clone, please make sure to clone the whole tree")

View File

@ -117,7 +117,7 @@ func validate(ctx *context.Context) error {
return pipe.ErrSkipValidateEnabled
}
if _, err := os.Stat(".git/shallow"); err == nil {
return ErrShallowClone
log.Warn("running against a shallow clone - check your CI documentation at https://goreleaser.com/ci")
}
out, err := git.Run("status", "--porcelain")
if strings.TrimSpace(out) != "" || err != nil {

View File

@ -128,8 +128,8 @@ func TestShallowClone(t *testing.T) {
).Run(),
)
t.Run("all checks up", func(t *testing.T) {
err := Pipe{}.Run(context.New(config.Project{}))
require.EqualError(t, err, ErrShallowClone.Error())
// its just a warning now
require.NoError(t, Pipe{}.Run(context.New(config.Project{})))
})
t.Run("skip validate is set", func(t *testing.T) {
ctx := context.New(config.Project{})

View File

@ -45,8 +45,9 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
!!! info
Note the `fetch-depth: 0` option on the `Checkout` workflow step. It is required for the change log to work correctly.
!!! warning
Note the `fetch-depth: 0` option on the `Checkout` workflow step. It is required for GoReleaser to work properly.
Without that, you might see a "refusing to run against a shallow clone" error.
### Run on new tag