configure upload URL when github_api_url
is set
[#99533974] Signed-off-by: Corbin Halliwill <challiwill@pivotal.io>
This commit is contained in:
committed by
Corbin Halliwill
parent
da17fb3d2f
commit
91b8f79018
@@ -19,6 +19,10 @@ Fetches and creates versioned GitHub resources.
|
||||
* `github_api_url`: *Optional.* If you use a non-public GitHub deployment then
|
||||
you can set your API URL here.
|
||||
|
||||
* `github_uploads_url`: *Optional.* Some GitHub instances have a separate URL
|
||||
for uploading. If `github_api_url` is set, this value defaults to the same
|
||||
value, but if you have your own endpoint, this field will override it.
|
||||
|
||||
* `drafts`: *Optional. Default `false`.* When set to `true`, `put` produces
|
||||
drafts and `check` only detects drafts. If `false`, only non-draft releases
|
||||
will be detected and published. Note that releases must have semver compliant
|
||||
|
13
github.go
13
github.go
@@ -55,6 +55,19 @@ func NewGitHubClient(source Source) (*GitHubClient, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
client.UploadURL, err = url.Parse(source.GitHubAPIURL)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if source.GitHubUploadsURL != "" {
|
||||
var err error
|
||||
client.UploadURL, err = url.Parse(source.GitHubUploadsURL)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &GitHubClient{
|
||||
|
@@ -4,9 +4,10 @@ type Source struct {
|
||||
User string `json:"user"`
|
||||
Repository string `json:"repository"`
|
||||
|
||||
GitHubAPIURL string `json:"github_api_url"`
|
||||
AccessToken string `json:"access_token"`
|
||||
Drafts bool `json:"drafts"`
|
||||
GitHubAPIURL string `json:"github_api_url"`
|
||||
GitHubUploadsURL string `json:"github_uploads_url"`
|
||||
AccessToken string `json:"access_token"`
|
||||
Drafts bool `json:"drafts"`
|
||||
}
|
||||
|
||||
type CheckRequest struct {
|
||||
|
Reference in New Issue
Block a user