mirror of
https://github.com/thegeeklab/wp-gitea-release.git
synced 2024-11-21 13:50:40 +00:00
cleanup gitea options struct
This commit is contained in:
parent
14e918c6cb
commit
d88993d496
@ -29,10 +29,10 @@ type Client struct {
|
||||
|
||||
type Release struct {
|
||||
client APIClient
|
||||
Opt ReleaseOpt
|
||||
Opt ReleaseOptions
|
||||
}
|
||||
|
||||
type ReleaseOpt struct {
|
||||
type ReleaseOptions struct {
|
||||
Owner string
|
||||
Repo string
|
||||
Tag string
|
||||
@ -56,7 +56,7 @@ func NewClient(url, key string, client *http.Client) (*Client, error) {
|
||||
client: c,
|
||||
Release: &Release{
|
||||
client: c,
|
||||
Opt: ReleaseOpt{},
|
||||
Opt: ReleaseOptions{},
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
@ -18,13 +18,13 @@ import (
|
||||
func TestReleaseFind(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
opt ReleaseOpt
|
||||
opt ReleaseOptions
|
||||
want *gitea.Release
|
||||
wantErr error
|
||||
}{
|
||||
{
|
||||
name: "find release by tag",
|
||||
opt: ReleaseOpt{
|
||||
opt: ReleaseOptions{
|
||||
Owner: "test-owner",
|
||||
Repo: "test-repo",
|
||||
Tag: "v1.0.0",
|
||||
@ -35,7 +35,7 @@ func TestReleaseFind(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "release not found",
|
||||
opt: ReleaseOpt{
|
||||
opt: ReleaseOptions{
|
||||
Owner: "test-owner",
|
||||
Repo: "test-repo",
|
||||
Tag: "v1.1.0",
|
||||
@ -84,13 +84,13 @@ func TestReleaseFind(t *testing.T) {
|
||||
func TestReleaseCreate(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
opt ReleaseOpt
|
||||
opt ReleaseOptions
|
||||
want *gitea.Release
|
||||
wantErr error
|
||||
}{
|
||||
{
|
||||
name: "create release",
|
||||
opt: ReleaseOpt{
|
||||
opt: ReleaseOptions{
|
||||
Owner: "test-owner",
|
||||
Repo: "test-repo",
|
||||
Tag: "v1.1.0",
|
||||
@ -109,7 +109,7 @@ func TestReleaseCreate(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "create draft release",
|
||||
opt: ReleaseOpt{
|
||||
opt: ReleaseOptions{
|
||||
Owner: "test-owner",
|
||||
Repo: "test-repo",
|
||||
Tag: "v1.2.0",
|
||||
@ -128,7 +128,7 @@ func TestReleaseCreate(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "create prerelease",
|
||||
opt: ReleaseOpt{
|
||||
opt: ReleaseOptions{
|
||||
Owner: "test-owner",
|
||||
Repo: "test-repo",
|
||||
Tag: "v1.3.0-rc1",
|
||||
@ -192,7 +192,7 @@ func TestReleaseAddAttachments(t *testing.T) {
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
opt ReleaseOpt
|
||||
opt ReleaseOptions
|
||||
files []string
|
||||
fileExists string
|
||||
wantErr error
|
||||
@ -200,7 +200,7 @@ func TestReleaseAddAttachments(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
name: "add new attachments",
|
||||
opt: ReleaseOpt{
|
||||
opt: ReleaseOptions{
|
||||
Owner: "test-owner",
|
||||
Repo: "test-repo",
|
||||
Tag: "v2.0.0",
|
||||
@ -212,7 +212,7 @@ func TestReleaseAddAttachments(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "fail on existing attachments",
|
||||
opt: ReleaseOpt{
|
||||
opt: ReleaseOptions{
|
||||
Owner: "test-owner",
|
||||
Repo: "test-repo",
|
||||
Tag: "v2.0.0",
|
||||
@ -224,7 +224,7 @@ func TestReleaseAddAttachments(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "overwrite on existing attachments",
|
||||
opt: ReleaseOpt{
|
||||
opt: ReleaseOptions{
|
||||
Owner: "test-owner",
|
||||
Repo: "test-repo",
|
||||
Tag: "v2.0.0",
|
||||
@ -236,7 +236,7 @@ func TestReleaseAddAttachments(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "skip on existing attachments",
|
||||
opt: ReleaseOpt{
|
||||
opt: ReleaseOptions{
|
||||
Owner: "test-owner",
|
||||
Repo: "test-repo",
|
||||
Tag: "v2.0.0",
|
||||
@ -248,7 +248,7 @@ func TestReleaseAddAttachments(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "fail on invalid file",
|
||||
opt: ReleaseOpt{
|
||||
opt: ReleaseOptions{
|
||||
Owner: "test-owner",
|
||||
Repo: "test-repo",
|
||||
Tag: "v2.0.0",
|
||||
|
@ -74,7 +74,7 @@ func (p *Plugin) Execute() error {
|
||||
return fmt.Errorf("failed to create Gitea client: %w", err)
|
||||
}
|
||||
|
||||
client.Release.Opt = gitea.ReleaseOpt{
|
||||
client.Release.Opt = gitea.ReleaseOptions{
|
||||
Owner: p.Metadata.Repository.Owner,
|
||||
Repo: p.Metadata.Repository.Name,
|
||||
Tag: strings.TrimPrefix(p.Settings.CommitRef, "refs/tags/"),
|
||||
|
Loading…
Reference in New Issue
Block a user