mirror of
https://github.com/thegeeklab/wp-git-action.git
synced 2024-06-03 04:39:42 +02:00
Compare commits
2 Commits
98d75d4493
...
fcf2d25be2
Author | SHA1 | Date | |
---|---|---|---|
fcf2d25be2 | |||
|
51113c4d34 |
|
@ -1,4 +1,4 @@
|
||||||
FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.22@sha256:d5302d40dc5fbbf38ec472d1848a9d2391a13f93293a6a5b0b87c99dc0eaa6ae as build
|
FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.22@sha256:b1e05e2c918f52c59d39ce7d5844f73b2f4511f7734add8bb98c9ecdd4443365 as build
|
||||||
|
|
||||||
ARG TARGETOS
|
ARG TARGETOS
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
|
|
@ -23,10 +23,10 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ActionClone Action = "clone"
|
GitActionClone GitAction = "clone"
|
||||||
ActionCommit Action = "commit"
|
GitActionCommit GitAction = "commit"
|
||||||
ActionPush Action = "push"
|
GitActionPush GitAction = "push"
|
||||||
ActionPages Action = "pages"
|
GitActionPages GitAction = "pages"
|
||||||
)
|
)
|
||||||
|
|
||||||
//nolint:revive
|
//nolint:revive
|
||||||
|
@ -57,17 +57,17 @@ func (p *Plugin) Validate() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, actionStr := range p.Settings.Action.Value() {
|
for _, actionStr := range p.Settings.Action.Value() {
|
||||||
action := Action(actionStr)
|
action := GitAction(actionStr)
|
||||||
switch action {
|
switch action {
|
||||||
case ActionClone:
|
case GitActionClone:
|
||||||
continue
|
continue
|
||||||
case ActionCommit:
|
case GitActionCommit:
|
||||||
continue
|
continue
|
||||||
case ActionPush:
|
case GitActionPush:
|
||||||
if p.Settings.SSHKey == "" && p.Settings.Netrc.Password == "" {
|
if p.Settings.SSHKey == "" && p.Settings.Netrc.Password == "" {
|
||||||
return ErrAuthSourceNotSet
|
return ErrAuthSourceNotSet
|
||||||
}
|
}
|
||||||
case ActionPages:
|
case GitActionPages:
|
||||||
p.Settings.Pages.Directory = filepath.Join(p.Settings.Repo.WorkDir, p.Settings.Pages.Directory)
|
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")
|
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))
|
batchCmd = append(batchCmd, p.Settings.Repo.ConfigSSLVerify(p.Network.InsecureSkipVerify))
|
||||||
|
|
||||||
for _, actionStr := range p.Settings.Action.Value() {
|
for _, actionStr := range p.Settings.Action.Value() {
|
||||||
action := Action(actionStr)
|
action := GitAction(actionStr)
|
||||||
switch action {
|
switch action {
|
||||||
case ActionClone:
|
case GitActionClone:
|
||||||
cmds, err := p.handleClone()
|
cmds, err := p.handleClone()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
batchCmd = append(batchCmd, cmds...)
|
batchCmd = append(batchCmd, cmds...)
|
||||||
case ActionCommit:
|
case GitActionCommit:
|
||||||
batchCmd = append(batchCmd, p.handleCommit()...)
|
batchCmd = append(batchCmd, p.handleCommit()...)
|
||||||
case ActionPush:
|
case GitActionPush:
|
||||||
batchCmd = append(batchCmd, p.handlePush()...)
|
batchCmd = append(batchCmd, p.handlePush()...)
|
||||||
case ActionPages:
|
case GitActionPages:
|
||||||
cmds, err := p.handlePages()
|
cmds, err := p.handlePages()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -38,7 +38,7 @@ type Pages struct {
|
||||||
Delete bool
|
Delete bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type Action string
|
type GitAction string
|
||||||
|
|
||||||
func New(e wp.ExecuteFunc, build ...string) *Plugin {
|
func New(e wp.ExecuteFunc, build ...string) *Plugin {
|
||||||
p := &Plugin{
|
p := &Plugin{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user