File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,11 @@ func main() {
4747 Usage : "create a draft release" ,
4848 EnvVar : "PLUGIN_DRAFT,GITEA_RELEASE_DRAFT" ,
4949 },
50+ cli.BoolFlag {
51+ Name : "insecure" ,
52+ Usage : "visit base-url via insecure https protocol" ,
53+ EnvVar : "PLUGIN_INSECURE,GITEA_RELEASE_INSECURE" ,
54+ },
5055 cli.BoolFlag {
5156 Name : "prerelease" ,
5257 Usage : "set the release as prerelease" ,
@@ -126,6 +131,7 @@ func run(c *cli.Context) error {
126131 Draft : c .Bool ("draft" ),
127132 PreRelease : c .Bool ("prerelease" ),
128133 BaseURL : c .String ("base-url" ),
134+ Insecure : c .Bool ("insecure" ),
129135 Title : c .String ("title" ),
130136 Note : c .String ("note" ),
131137 },
Original file line number Diff line number Diff line change 11package main
22
33import (
4+ "crypto/tls"
45 "fmt"
6+ "io/ioutil"
7+ "net/http"
8+ "net/http/cookiejar"
9+ "os"
510 "path/filepath"
611 "strings"
712
813 "code.gitea.io/sdk/gitea"
9- "io/ioutil"
10- "os"
1114)
1215
1316type (
3134 Checksum []string
3235 Draft bool
3336 PreRelease bool
37+ Insecure bool
3438 BaseURL string
3539 Title string
3640 Note string
@@ -108,6 +112,18 @@ func (p Plugin) Exec() error {
108112
109113 client := gitea .NewClient (p .Config .BaseURL , p .Config .APIKey )
110114
115+ if p .Config .Insecure {
116+ cookieJar , _ := cookiejar .New (nil )
117+
118+ var insecureClient = & http.Client {
119+ Jar : cookieJar ,
120+ Transport : & http.Transport {
121+ TLSClientConfig : & tls.Config {InsecureSkipVerify : true },
122+ },
123+ }
124+ client .SetHTTPClient (insecureClient )
125+ }
126+
111127 rc := releaseClient {
112128 Client : client ,
113129 Owner : p .Repo .Owner ,
You can’t perform that action at this time.
0 commit comments