Repository: goreleaser/goreleaser
Pull request #3089 (2022-05-09 08:02:23)

feat(deps): bump github.com/jarcoal/httpmock from 1.1.0 to 1.2.0
Bumps [github.com/jarcoal/httpmock](https://github.com/jarcoal/httpmock) from 1.1.0 to 1.2.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/jarcoal/httpmock/releases">github.com/jarcoal/httpmock's releases</a>.</em></p>
<blockquote>
<h2>v1.2.0</h2>
<p>New features:</p>
<ul>
<li><a href="https://pkg.go.dev/github.com/jarcoal/httpmock#NewNotFoundResponder"><code>NewNotFoundResponder</code></a> helps to detect a possible path mistake (final <code>/</code> or double <code>/</code> cases);</li>
<li>add <a href="https://pkg.go.dev/github.com/jarcoal/httpmock#MockTransport.Responders"><code>(*MockTransport).Responders</code></a> method allowing to list registered responders.</li>
</ul>
<p>Fixes:</p>
<ul>
<li>
<p><code>url.RawPath</code> is used instead of <code>url.Path</code> when checking path alone for consistency with full URL check, which is always unescaped.
Let 2 registered responders:</p>
<ol>
<li><code>GET http://z.tld/foo%2fbar</code></li>
<li><code>GET /foo%2fbar</code></li>
</ol>
<p>Before this release:</p>
<ul>
<li><code>GET http://z.tld/foo%2fbar</code> is caught by 1</li>
<li><code>GET http://unknown.tld/foo%2fbar</code> is <strong>not</strong> caught as the tested path is <code>/foo/bar</code> instead of <code>/foo%2fbar</code></li>
</ul>
<p>From this release:</p>
<ul>
<li><code>GET http://z.tld/foo%2fbar</code> is caught by 1</li>
<li><code>GET http://unknown.tld/foo%2fbar</code> is caught by 2</li>
</ul>
</li>
<li>
<p>save of old clients transports is now protected from concurrent writes (<a href="https://github.com/roboslone"><code>@​roboslone</code></a>).</p>
</li>
</ul>
<p>Miscellaneous:</p>
<ul>
<li>now use <a href="https://go-testdeep.zetta.rocks/">go-testdeep</a> to simplify tests (saves &gt;500 test lines);</li>
<li>go minimal version required is now 1.9;</li>
<li>CI tests using go1.18 &amp; golangci-lint v1.45.0;</li>
<li>signatures (and so documentation) now use <code>any</code> type instead of <code>interface{}</code>, as appeared in go 1.18 (in a compatible manner with go&lt;1.18).</li>
</ul>
<p>Enjoy!</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/jarcoal/httpmock/commit/fbf2267d806e7bf4e6bb5778bdacd57fa3706509"><code>fbf2267</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/jarcoal/httpmock/issues/128">#128</a> from roboslone/v1</li>
<li><a href="https://github.com/jarcoal/httpmock/commit/da037fbfee4613f30c70420545ceba8d3241585a"><code>da037fb</code></a> fix concurrent map writes to oldClients</li>
<li><a href="https://github.com/jarcoal/httpmock/commit/70189fd3cbfa8d119c4725fb3ab6cede7cdb9f73"><code>70189fd</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/jarcoal/httpmock/issues/127">#127</a> from jarcoal/td-example</li>
<li><a href="https://github.com/jarcoal/httpmock/commit/3cfaf8ff1407b417ea0913d8ecfad2d180bb9696"><code>3cfaf8f</code></a> docs: add go-testdeep example</li>
<li><a href="https://github.com/jarcoal/httpmock/commit/377286aad7d0590b9ecce08fdd8e233d87e77415"><code>377286a</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/jarcoal/httpmock/issues/126">#126</a> from jarcoal/any</li>
<li><a href="https://github.com/jarcoal/httpmock/commit/afe87ee5d1588913f0695560724ba8da761c04a5"><code>afe87ee</code></a> refactor: since go1.18 use any instead of interface{}</li>
<li><a href="https://github.com/jarcoal/httpmock/commit/bbd5dcb0762f6c06c941b8b0182f4a48559ebbf0"><code>bbd5dcb</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/jarcoal/httpmock/issues/125">#125</a> from jarcoal/go118</li>
<li><a href="https://github.com/jarcoal/httpmock/commit/6b1d5765b1ea86afef6dc725284ed1a1845a2850"><code>6b1d576</code></a> ci: enable go1.18 + upgrade golangci-lint to v1.45.0</li>
<li><a href="https://github.com/jarcoal/httpmock/commit/0be0f8bf5ae5af80b6b160ec2ffdb204ed29c2bb"><code>0be0f8b</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/jarcoal/httpmock/issues/124">#124</a> from jarcoal/responders</li>
<li><a href="https://github.com/jarcoal/httpmock/commit/9bab1364759b6db0db620feb6d63bbd8eee8d0ca"><code>9bab136</code></a> feat: add (*MockTransport).Responders() method</li>
<li>Additional commits viewable in <a href="https://github.com/jarcoal/httpmock/compare/v1.1.0...v1.2.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/jarcoal/httpmock&package-manager=go_modules&previous-version=1.1.0&new-version=1.2.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

codecov[bot]: # [Codecov](https://codecov.io/gh/goreleaser/goreleaser/pull/3089?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser) Report
> Merging [#3089](https://codecov.io/gh/goreleaser/goreleaser/pull/3089?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser) (646dfbc) into [main](https://codecov.io/gh/goreleaser/goreleaser/commit/e2902707f9dabe787e5f72dda91adef70ce0396d?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser) (e290270) will **not change** coverage.
> The diff coverage is `n/a`.

```diff
@@           Coverage Diff           @@
##             main    #3089   +/-   ##
=======================================
  Coverage   84.29%   84.29%           
=======================================
  Files         112      112           
  Lines        9250     9250           
=======================================
  Hits         7797     7797           
  Misses       1178     1178           
  Partials      275      275           
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/goreleaser/goreleaser/pull/3089?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/goreleaser/goreleaser/pull/3089?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser). Last update [e290270...646dfbc](https://codecov.io/gh/goreleaser/goreleaser/pull/3089?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser).


Patch:
diff --git a/go.mod b/go.mod
index eaecfaf0..b580b821 100644
--- a/go.mod
+++ b/go.mod
@@ -23,7 +23,7 @@ require (
 	github.com/goreleaser/fileglob v1.3.0
 	github.com/goreleaser/nfpm/v2 v2.15.1
 	github.com/imdario/mergo v0.3.12
-	github.com/jarcoal/httpmock v1.1.0
+	github.com/jarcoal/httpmock v1.2.0
 	github.com/klauspost/pgzip v1.2.5
 	github.com/mitchellh/go-homedir v1.1.0
 	github.com/muesli/mango-cobra v1.1.0
diff --git a/go.sum b/go.sum
index 2995fc3a..1fb57b62 100644
--- a/go.sum
+++ b/go.sum
@@ -476,8 +476,8 @@ github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
 github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
 github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
 github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
-github.com/jarcoal/httpmock v1.1.0 h1:F47ChZj1Y2zFsCXxNkBPwNNKnAyOATcdQibk0qEdVCE=
-github.com/jarcoal/httpmock v1.1.0/go.mod h1:ATjnClrvW/3tijVmpL/va5Z3aAyGvqU3gCT8nX0Txik=
+github.com/jarcoal/httpmock v1.2.0 h1:gSvTxxFR/MEMfsGrvRbdfpRUMBStovlSRLw0Ep1bwwc=
+github.com/jarcoal/httpmock v1.2.0/go.mod h1:oCoTsnAz4+UoOUIf5lJOWV2QQIW5UoeUI6aM2YnWAZk=
 github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
 github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
 github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
@@ -541,6 +541,7 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky
 github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
 github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
 github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
+github.com/maxatome/go-testdeep v1.11.0 h1:Tgh5efyCYyJFGUYiT0qxBSIDeXw0F5zSoatlou685kk=
 github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
 github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
 github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
diff --git a/internal/git/config.go b/internal/git/config.go
index 9b9943b2..2987ebd5 100644
--- a/internal/git/config.go
+++ b/internal/git/config.go
@@ -16,7 +16,7 @@ func ExtractRepoFromConfig(ctx context.Context) (result config.Repo, err error)
 	if !IsRepo(ctx) {
 		return result, errors.New("current folder is not a git repository")
 	}
-	out, err := Run(ctx, "ls-remote", "--get-url")
+	out, err := Clean(Run(ctx, "ls-remote", "--get-url"))
 	if err != nil {
 		return result, fmt.Errorf("no remote configured to list refs from")
 	}
@@ -44,19 +44,32 @@ func ExtractRepoFromURL(rawurl string) (config.Repo, error) {
 	// now we can parse it with net/url
 	u, err := url.Parse(s)
 	if err != nil {
-		return config.Repo{}, err
+		return config.Repo{
+			RawURL: rawurl,
+		}, err
 	}
 
 	// split the parsed url path by /, the last parts should be the owner and name
 	ss := strings.Split(strings.TrimPrefix(u.Path, "/"), "/")
 
-	// if less than 2 parts, its likely not a valid repository
+	// if empty, returns an error
+	if len(ss) == 0 || ss[0] == "" {
+		return config.Repo{
+			RawURL: rawurl,
+		}, fmt.Errorf("unsupported repository URL: %s", rawurl)
+	}
+
+	// if less than 2 parts, its likely not a valid repository, but we'll allow it.
 	if len(ss) < 2 {
-		return config.Repo{}, fmt.Errorf("unsupported repository URL: %s", rawurl)
+		return config.Repo{
+			RawURL: rawurl,
+			Owner:  ss[0],
+		}, nil
 	}
 	repo := config.Repo{
-		Owner: strings.Join(ss[:len(ss)-1], "/"),
-		Name:  ss[len(ss)-1],
+		RawURL: rawurl,
+		Owner:  strings.Join(ss[:len(ss)-1], "/"),
+		Name:   ss[len(ss)-1],
 	}
 	log.WithField("owner", repo.Owner).WithField("name", repo.Name).Debugf("parsed url")
 	return repo, nil
diff --git a/internal/pipe/changelog/changelog.go b/internal/pipe/changelog/changelog.go
index 5eb9af14..8c3997a6 100644
--- a/internal/pipe/changelog/changelog.go
+++ b/internal/pipe/changelog/changelog.go
@@ -287,6 +287,9 @@ func newGithubChangeloger(ctx *context.Context) (changeloger, error) {
 	if err != nil {
 		return nil, err
 	}
+	if err := repo.CheckSCM(); err != nil {
+		return nil, err
+	}
 	return &githubNativeChangeloger{
 		client: cli,
 		repo: client.Repo{
@@ -305,6 +308,9 @@ func newSCMChangeloger(ctx *context.Context) (changeloger, error) {
 	if err != nil {
 		return nil, err
 	}
+	if err := repo.CheckSCM(); err != nil {
+		return nil, err
+	}
 	return &scmChangeloger{
 		client: cli,
 		repo: client.Repo{
diff --git a/internal/pipe/milestone/milestone.go b/internal/pipe/milestone/milestone.go
index 05c05c24..ee8526b3 100644
--- a/internal/pipe/milestone/milestone.go
+++ b/internal/pipe/milestone/milestone.go
@@ -29,10 +29,12 @@ func (Pipe) Default(ctx *context.Context) error {
 
 		if milestone.Repo.Name == "" {
 			repo, err := git.ExtractRepoFromConfig(ctx)
-
 			if err != nil && !ctx.Snapshot {
 				return err
 			}
+			if err := repo.CheckSCM(); err != nil && !ctx.Snapshot {
+				return err
+			}
 
 			milestone.Repo = repo
 		}
diff --git a/internal/pipe/release/release.go b/internal/pipe/release/release.go
index 8208d331..b5a3d9c8 100644
--- a/internal/pipe/release/release.go
+++ b/internal/pipe/release/release.go
@@ -12,6 +12,7 @@ import (
 	"github.com/goreleaser/goreleaser/internal/extrafiles"
 	"github.com/goreleaser/goreleaser/internal/git"
 	"github.com/goreleaser/goreleaser/internal/semerrgroup"
+	"github.com/goreleaser/goreleaser/pkg/config"
 	"github.com/goreleaser/goreleaser/pkg/context"
 )
 
@@ -48,7 +49,7 @@ func (Pipe) Default(ctx *context.Context) error {
 	switch ctx.TokenType {
 	case context.TokenTypeGitLab:
 		if ctx.Config.Release.GitLab.Name == "" {
-			repo, err := git.ExtractRepoFromConfig(ctx)
+			repo, err := getRepository(ctx)
 			if err != nil {
 				return err
 			}
@@ -63,7 +64,7 @@ func (Pipe) Default(ctx *context.Context) error {
 		)
 	case context.TokenTypeGitea:
 		if ctx.Config.Release.Gitea.Name == "" {
-			repo, err := git.ExtractRepoFromConfig(ctx)
+			repo, err := getRepository(ctx)
 			if err != nil {
 				return err
 			}
@@ -79,7 +80,7 @@ func (Pipe) Default(ctx *context.Context) error {
 	default:
 		// We keep github as default for now
 		if ctx.Config.Release.GitHub.Name == "" {
-			repo, err := git.ExtractRepoFromConfig(ctx)
+			repo, err := getRepository(ctx)
 			if err != nil && !ctx.Snapshot {
 				return err
 			}
@@ -109,6 +110,17 @@ func (Pipe) Default(ctx *context.Context) error {
 	return nil
 }
 
+func getRepository(ctx *context.Context) (config.Repo, error) {
+	repo, err := git.ExtractRepoFromConfig(ctx)
+	if err != nil {
+		return config.Repo{}, err
+	}
+	if err := repo.CheckSCM(); err != nil {
+		return config.Repo{}, err
+	}
+	return repo, nil
+}
+
 // Publish the release.
 func (Pipe) Publish(ctx *context.Context) error {
 	c, err := client.New(ctx)
diff --git a/pkg/config/config.go b/pkg/config/config.go
index f3720dce..82b1a3ee 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -4,6 +4,7 @@ package config
 
 import (
 	"encoding/json"
+	"fmt"
 	"io"
 	"os"
 	"strings"
@@ -42,16 +43,30 @@ type GiteaURLs struct {
 // Repo represents any kind of repo (github, gitlab, etc).
 // to upload releases into.
 type Repo struct {
-	Owner string `yaml:"owner,omitempty"`
-	Name  string `yaml:"name,omitempty"`
+	Owner  string `yaml:"owner,omitempty"`
+	Name   string `yaml:"name,omitempty"`
+	RawURL string `yaml:"-"`
 }
 
 // String of the repo, e.g. owner/name.
 func (r Repo) String() string {
-	if r.Owner == "" && r.Name == "" {
-		return ""
+	if r.isSCM() {
+		return r.Owner + "/" + r.Name
 	}
-	return r.Owner + "/" + r.Name
+	return r.Owner
+}
+
+// CheckSCM returns an error if the given url is not a valid scm url.
+func (r Repo) CheckSCM() error {
+	if r.isSCM() {
+		return nil
+	}
+	return fmt.Errorf("invalid scm url: %s", r.RawURL)
+}
+
+// isSCM returns true if the repo has both an owner and name.
+func (r Repo) isSCM() bool {
+	return r.Owner != "" && r.Name != ""
 }
 
 // RepoRef represents any kind of repo which may differ
diff --git a/www/docs/overrides/home.html b/www/docs/overrides/home.html
index 87c600a9..338c3861 100644
--- a/www/docs/overrides/home.html
+++ b/www/docs/overrides/home.html
@@ -134,8 +134,9 @@
 					<li>Create nightly builds</li>
 					<li>Create Docker images and manifests</li>
 					<li>Create Linux packages and Homebrew taps</li>
-					<li>Sign artifacts, checksums and Docker images</li>
+					<li>Sign artifacts, checksums and container images</li>
 					<li>Announce new releases on Twitter, Slack, Discord and others</li>
+					<li>Generate SBOMs (Software Bill of Materials) for binaries and container images</li> 
 					<li>... and much more!</li>
 				</ul>
 				<a href="{{ page.next_page.url | url }}" title="{{ page.next_page.title | striptags }}"
diff --git a/www/docs/static/schema.json b/www/docs/static/schema.json
index 342d8a11..488cd4e6 100644
--- a/www/docs/static/schema.json
+++ b/www/docs/static/schema.json
@@ -321,9 +321,15 @@
 					"gobinary": {
 						"type": "string"
 					},
+					"command": {
+						"type": "string"
+					},
 					"no_unique_dist_dir": {
 						"type": "boolean"
 					},
+					"no_main_check": {
+						"type": "boolean"
+					},
 					"ldflags": {
 						"oneOf": [
 							{


Test patch:
diff --git a/internal/git/config_test.go b/internal/git/config_test.go
index 1519c6c1..8de694ac 100644
--- a/internal/git/config_test.go
+++ b/internal/git/config_test.go
@@ -60,6 +60,8 @@ func TestExtractRepoFromURL(t *testing.T) {
 			repo, err := git.ExtractRepoFromURL(url)
 			require.NoError(t, err)
 			require.Equal(t, "goreleaser/goreleaser", repo.String())
+			require.NoError(t, repo.CheckSCM())
+			require.Equal(t, url, repo.RawURL)
 		})
 	}
 
@@ -73,18 +75,35 @@ func TestExtractRepoFromURL(t *testing.T) {
 			repo, err := git.ExtractRepoFromURL(url)
 			require.NoError(t, err)
 			require.Equal(t, "group/nested/goreleaser/goreleaser", repo.String())
+			require.NoError(t, repo.CheckSCM())
+			require.Equal(t, url, repo.RawURL)
 		})
 	}
 
-	// invalid urls
 	for _, url := range []string{
 		"git@gist.github.com:someid.git",
 		"https://gist.github.com/someid.git",
+	} {
+		t.Run(url, func(t *testing.T) {
+			repo, err := git.ExtractRepoFromURL(url)
+			require.NoError(t, err)
+			require.Equal(t, "someid", repo.String())
+			require.Error(t, repo.CheckSCM())
+			require.Equal(t, url, repo.RawURL)
+		})
+	}
+
+	// invalid urls
+	for _, url := range []string{
+		"git@gist.github.com:",
+		"https://gist.github.com/",
 	} {
 		t.Run(url, func(t *testing.T) {
 			repo, err := git.ExtractRepoFromURL(url)
 			require.EqualError(t, err, "unsupported repository URL: "+url)
 			require.Equal(t, "", repo.String())
+			require.Error(t, repo.CheckSCM())
+			require.Equal(t, url, repo.RawURL)
 		})
 	}
 }
diff --git a/internal/pipe/changelog/changelog_test.go b/internal/pipe/changelog/changelog_test.go
index 886b9fa2..776747dd 100644
--- a/internal/pipe/changelog/changelog_test.go
+++ b/internal/pipe/changelog/changelog_test.go
@@ -536,6 +536,21 @@ func TestGetChangeloger(t *testing.T) {
 		require.IsType(t, c, &githubNativeChangeloger{})
 	})
 
+	t.Run(useGitHubNative+"-invalid-repo", func(t *testing.T) {
+		testlib.Mktmp(t)
+		testlib.GitInit(t)
+		testlib.GitRemoteAdd(t, "https://gist.github.com/")
+		ctx := context.New(config.Project{
+			Changelog: config.Changelog{
+				Use: useGitHubNative,
+			},
+		})
+		ctx.TokenType = context.TokenTypeGitHub
+		c, err := getChangeloger(ctx)
+		require.EqualError(t, err, "unsupported repository URL: https://gist.github.com/")
+		require.Nil(t, c)
+	})
+
 	t.Run(useGitLab, func(t *testing.T) {
 		ctx := context.New(config.Project{
 			Changelog: config.Changelog{
@@ -548,6 +563,21 @@ func TestGetChangeloger(t *testing.T) {
 		require.IsType(t, c, &scmChangeloger{})
 	})
 
+	t.Run(useGitHub+"-invalid-repo", func(t *testing.T) {
+		testlib.Mktmp(t)
+		testlib.GitInit(t)
+		testlib.GitRemoteAdd(t, "https://gist.github.com/")
+		ctx := context.New(config.Project{
+			Changelog: config.Changelog{
+				Use: useGitHub,
+			},
+		})
+		ctx.TokenType = context.TokenTypeGitHub
+		c, err := getChangeloger(ctx)
+		require.EqualError(t, err, "unsupported repository URL: https://gist.github.com/")
+		require.Nil(t, c)
+	})
+
 	t.Run("invalid", func(t *testing.T) {
 		c, err := getChangeloger(context.New(config.Project{
 			Changelog: config.Changelog{
diff --git a/internal/pipe/milestone/milestone_test.go b/internal/pipe/milestone/milestone_test.go
index a15b41a9..1255143c 100644
--- a/internal/pipe/milestone/milestone_test.go
+++ b/internal/pipe/milestone/milestone_test.go
@@ -31,6 +31,18 @@ func TestDefaultWithRepoConfig(t *testing.T) {
 	require.Equal(t, "configowner", ctx.Config.Milestones[0].Repo.Owner)
 }
 
+func TestDefaultWithInvalidRemote(t *testing.T) {
+	testlib.Mktmp(t)
+	testlib.GitInit(t)
+	testlib.GitRemoteAdd(t, "git@github.com:githubowner.git")
+
+	ctx := context.New(config.Project{
+		Milestones: []config.Milestone{{}},
+	})
+	ctx.TokenType = context.TokenTypeGitHub
+	require.Error(t, Pipe{}.Default(ctx))
+}
+
 func TestDefaultWithRepoRemote(t *testing.T) {
 	testlib.Mktmp(t)
 	testlib.GitInit(t)
diff --git a/internal/pipe/release/release_test.go b/internal/pipe/release/release_test.go
index 6c29e9c8..2414954e 100644
--- a/internal/pipe/release/release_test.go
+++ b/internal/pipe/release/release_test.go
@@ -354,6 +354,18 @@ func TestDefault(t *testing.T) {
 	require.Equal(t, "https://github.com/goreleaser/goreleaser/releases/tag/v1.0.0", ctx.ReleaseURL)
 }
 
+func TestDefaultInvalidURL(t *testing.T) {
+	testlib.Mktmp(t)
+	testlib.GitInit(t)
+	testlib.GitRemoteAdd(t, "git@github.com:goreleaser.git")
+
+	ctx := context.New(config.Project{})
+	ctx.TokenType = context.TokenTypeGitHub
+	ctx.Config.GitHubURLs.Download = "https://github.com"
+	ctx.Git.CurrentTag = "v1.0.0"
+	require.Error(t, Pipe{}.Default(ctx))
+}
+
 func TestDefaultWithGitlab(t *testing.T) {
 	testlib.Mktmp(t)
 	testlib.GitInit(t)
@@ -369,6 +381,18 @@ func TestDefaultWithGitlab(t *testing.T) {
 	require.Equal(t, "https://gitlab.com/gitlabowner/gitlabrepo/-/releases/v1.0.0", ctx.ReleaseURL)
 }
 
+func TestDefaultWithGitlabInvalidURL(t *testing.T) {
+	testlib.Mktmp(t)
+	testlib.GitInit(t)
+	testlib.GitRemoteAdd(t, "git@gitlab.com:gitlabrepo.git")
+
+	ctx := context.New(config.Project{})
+	ctx.TokenType = context.TokenTypeGitLab
+	ctx.Config.GitLabURLs.Download = "https://gitlab.com"
+	ctx.Git.CurrentTag = "v1.0.0"
+	require.Error(t, Pipe{}.Default(ctx))
+}
+
 func TestDefaultWithGitea(t *testing.T) {
 	testlib.Mktmp(t)
 	testlib.GitInit(t)
@@ -384,6 +408,18 @@ func TestDefaultWithGitea(t *testing.T) {
 	require.Equal(t, "https://git.honk.com/giteaowner/gitearepo/releases/tag/v1.0.0", ctx.ReleaseURL)
 }
 
+func TestDefaultWithGiteaInvalidURL(t *testing.T) {
+	testlib.Mktmp(t)
+	testlib.GitInit(t)
+	testlib.GitRemoteAdd(t, "git@gitea.example.com:gitearepo.git")
+
+	ctx := context.New(config.Project{})
+	ctx.TokenType = context.TokenTypeGitea
+	ctx.Config.GiteaURLs.Download = "https://git.honk.com"
+	ctx.Git.CurrentTag = "v1.0.0"
+	require.Error(t, Pipe{}.Default(ctx))
+}
+
 func TestDefaultPreRelease(t *testing.T) {
 	testlib.Mktmp(t)
 	testlib.GitInit(t)