From fcf2d25be23cf03112075c50f300587a7f9642be Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Wed, 8 May 2024 12:45:24 +0200 Subject: [PATCH] rename action type --- plugin/impl.go | 28 ++++++++++++++-------------- plugin/plugin.go | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/plugin/impl.go b/plugin/impl.go index fe51fef..2eafd61 100644 --- a/plugin/impl.go +++ b/plugin/impl.go @@ -23,10 +23,10 @@ var ( ) const ( - ActionClone Action = "clone" - ActionCommit Action = "commit" - ActionPush Action = "push" - ActionPages Action = "pages" + GitActionClone GitAction = "clone" + GitActionCommit GitAction = "commit" + GitActionPush GitAction = "push" + GitActionPages GitAction = "pages" ) //nolint:revive @@ -57,17 +57,17 @@ func (p *Plugin) Validate() error { } for _, actionStr := range p.Settings.Action.Value() { - action := Action(actionStr) + action := GitAction(actionStr) switch action { - case ActionClone: + case GitActionClone: continue - case ActionCommit: + case GitActionCommit: continue - case ActionPush: + case GitActionPush: if p.Settings.SSHKey == "" && p.Settings.Netrc.Password == "" { return ErrAuthSourceNotSet } - case ActionPages: + case GitActionPages: p.Settings.Pages.Directory = filepath.Join(p.Settings.Repo.WorkDir, p.Settings.Pages.Directory) p.Settings.Repo.WorkDir = filepath.Join(p.Settings.Repo.WorkDir, ".tmp") @@ -160,20 +160,20 @@ func (p *Plugin) Execute() error { batchCmd = append(batchCmd, p.Settings.Repo.ConfigSSLVerify(p.Network.InsecureSkipVerify)) for _, actionStr := range p.Settings.Action.Value() { - action := Action(actionStr) + action := GitAction(actionStr) switch action { - case ActionClone: + case GitActionClone: cmds, err := p.handleClone() if err != nil { return err } batchCmd = append(batchCmd, cmds...) - case ActionCommit: + case GitActionCommit: batchCmd = append(batchCmd, p.handleCommit()...) - case ActionPush: + case GitActionPush: batchCmd = append(batchCmd, p.handlePush()...) - case ActionPages: + case GitActionPages: cmds, err := p.handlePages() if err != nil { return err diff --git a/plugin/plugin.go b/plugin/plugin.go index 7421915..79eeca1 100644 --- a/plugin/plugin.go +++ b/plugin/plugin.go @@ -38,7 +38,7 @@ type Pages struct { Delete bool } -type Action string +type GitAction string func New(e wp.ExecuteFunc, build ...string) *Plugin { p := &Plugin{