2022-11-27 13:33:39 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/thegeeklab/drone-git-action/plugin"
|
|
|
|
"github.com/urfave/cli/v2"
|
|
|
|
)
|
|
|
|
|
|
|
|
// settingsFlags has the cli.Flags for the plugin.Settings.
|
|
|
|
func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
|
|
|
|
return []cli.Flag{
|
|
|
|
&cli.StringSliceFlag{
|
|
|
|
Name: "actions",
|
2022-11-28 14:36:01 +00:00
|
|
|
Usage: "git actions to to execute",
|
2022-11-27 13:33:39 +00:00
|
|
|
EnvVars: []string{"PLUGIN_ACTIONS"},
|
|
|
|
Destination: &settings.Actions,
|
|
|
|
Required: true,
|
|
|
|
Category: category,
|
|
|
|
},
|
|
|
|
|
|
|
|
&cli.StringFlag{
|
2022-11-29 09:40:42 +00:00
|
|
|
Name: "commit-author-name",
|
2022-11-27 13:33:39 +00:00
|
|
|
Usage: "git author name",
|
|
|
|
EnvVars: []string{"PLUGIN_AUTHOR_NAME", "DRONE_COMMIT_AUTHOR"},
|
|
|
|
Destination: &settings.Commit.Author.Name,
|
|
|
|
Required: true,
|
|
|
|
Category: category,
|
|
|
|
},
|
|
|
|
&cli.StringFlag{
|
2022-11-29 09:40:42 +00:00
|
|
|
Name: "commit-author-email",
|
2022-11-27 13:33:39 +00:00
|
|
|
Usage: "git author email",
|
|
|
|
EnvVars: []string{"PLUGIN_AUTHOR_EMAIL", "DRONE_COMMIT_AUTHOR_EMAIL"},
|
|
|
|
Destination: &settings.Commit.Author.Email,
|
|
|
|
Required: true,
|
|
|
|
Category: category,
|
|
|
|
},
|
|
|
|
|
|
|
|
&cli.StringFlag{
|
2022-11-29 09:40:42 +00:00
|
|
|
Name: "netrc-machine",
|
2022-11-28 14:36:01 +00:00
|
|
|
Usage: "netrc remote machine name",
|
2022-11-27 13:33:39 +00:00
|
|
|
EnvVars: []string{"PLUGIN_NETRC_MACHINE", "DRONE_NETRC_MACHINE"},
|
|
|
|
Destination: &settings.Netrc.Machine,
|
2022-11-29 09:40:42 +00:00
|
|
|
Value: "github.com",
|
2022-11-27 13:33:39 +00:00
|
|
|
Category: category,
|
|
|
|
},
|
|
|
|
&cli.StringFlag{
|
2022-11-29 09:40:42 +00:00
|
|
|
Name: "netrc-username",
|
2022-11-28 14:36:01 +00:00
|
|
|
Usage: "netrc login user on the remote machine",
|
2022-11-27 13:33:39 +00:00
|
|
|
EnvVars: []string{"PLUGIN_NETRC_USERNAME", "DRONE_NETRC_USERNAME"},
|
|
|
|
Destination: &settings.Netrc.Login,
|
2022-11-29 09:40:42 +00:00
|
|
|
Value: "token",
|
2022-11-27 13:33:39 +00:00
|
|
|
Category: category,
|
|
|
|
},
|
|
|
|
&cli.StringFlag{
|
2022-11-29 09:40:42 +00:00
|
|
|
Name: "netrc-password",
|
2022-11-28 14:36:01 +00:00
|
|
|
Usage: "netrc login password on the remote machine",
|
2022-11-27 13:33:39 +00:00
|
|
|
EnvVars: []string{"PLUGIN_NETRC_PASSWORD", "DRONE_NETRC_PASSWORD"},
|
|
|
|
Destination: &settings.Netrc.Password,
|
|
|
|
Category: category,
|
|
|
|
},
|
|
|
|
&cli.StringFlag{
|
|
|
|
Name: "ssh-key",
|
2022-11-28 14:36:01 +00:00
|
|
|
Usage: "ssh private key for the remote repository",
|
2022-11-27 13:33:39 +00:00
|
|
|
EnvVars: []string{"PLUGIN_SSH_KEY"},
|
|
|
|
Destination: &settings.SSHKey,
|
|
|
|
Category: category,
|
|
|
|
},
|
|
|
|
|
|
|
|
&cli.StringFlag{
|
|
|
|
Name: "remote",
|
2022-11-28 14:36:01 +00:00
|
|
|
Usage: "url of the remote repository",
|
2022-11-27 13:33:39 +00:00
|
|
|
EnvVars: []string{"PLUGIN_REMOTE"},
|
|
|
|
Destination: &settings.Remote,
|
|
|
|
Category: category,
|
|
|
|
},
|
|
|
|
&cli.StringFlag{
|
|
|
|
Name: "branch",
|
2022-11-28 14:36:01 +00:00
|
|
|
Usage: "name of the git branch",
|
2022-11-27 13:33:39 +00:00
|
|
|
EnvVars: []string{"PLUGIN_BRANCH"},
|
|
|
|
Destination: &settings.Branch,
|
|
|
|
Value: "main",
|
|
|
|
Category: category,
|
|
|
|
},
|
|
|
|
|
|
|
|
&cli.StringFlag{
|
|
|
|
Name: "path",
|
2022-11-28 14:36:01 +00:00
|
|
|
Usage: "path to git repository",
|
2022-11-27 13:33:39 +00:00
|
|
|
EnvVars: []string{"PLUGIN_PATH"},
|
|
|
|
Destination: &settings.Path,
|
|
|
|
Category: category,
|
|
|
|
},
|
|
|
|
|
|
|
|
&cli.StringFlag{
|
|
|
|
Name: "message",
|
|
|
|
Usage: "commit message",
|
|
|
|
EnvVars: []string{"PLUGIN_MESSAGE"},
|
|
|
|
Destination: &settings.Message,
|
2022-11-29 09:40:42 +00:00
|
|
|
Value: "[skip ci] commit dirty state",
|
2022-11-27 13:33:39 +00:00
|
|
|
Category: category,
|
|
|
|
},
|
|
|
|
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "force",
|
2022-11-28 14:36:01 +00:00
|
|
|
Usage: "enable force push to remote repository",
|
2022-11-27 13:33:39 +00:00
|
|
|
EnvVars: []string{"PLUGIN_FORCE"},
|
|
|
|
Destination: &settings.Force,
|
2022-11-29 09:40:42 +00:00
|
|
|
Value: false,
|
2022-11-27 13:33:39 +00:00
|
|
|
Category: category,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "followtags",
|
2022-11-28 14:36:01 +00:00
|
|
|
Usage: "follow tags for pushes to remote repository",
|
2022-11-27 13:33:39 +00:00
|
|
|
EnvVars: []string{"PLUGIN_FOLLOWTAGS"},
|
|
|
|
Destination: &settings.FollowTags,
|
2022-11-29 09:40:42 +00:00
|
|
|
Value: false,
|
2022-11-27 13:33:39 +00:00
|
|
|
Category: category,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
2022-11-29 09:40:42 +00:00
|
|
|
Name: "insecure-ssl-verify",
|
|
|
|
Usage: "set SSL verification of the remote machine",
|
|
|
|
EnvVars: []string{"PLUGIN_INSECURE_SSL_VERIFY"},
|
|
|
|
Destination: &settings.InsecureSSLVerify,
|
|
|
|
Value: false,
|
2022-11-27 13:33:39 +00:00
|
|
|
Category: category,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "empty-commit",
|
|
|
|
Usage: "allow empty commits",
|
|
|
|
EnvVars: []string{"PLUGIN_EMPTY_COMMIT"},
|
|
|
|
Destination: &settings.EmptyCommit,
|
2022-11-29 09:40:42 +00:00
|
|
|
Value: false,
|
2022-11-27 13:33:39 +00:00
|
|
|
Category: category,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "no-verify",
|
2022-11-28 14:36:01 +00:00
|
|
|
Usage: "bypass the pre-commit and commit-msg hooks",
|
2022-11-27 13:33:39 +00:00
|
|
|
EnvVars: []string{"PLUGIN_NO_VERIFY"},
|
|
|
|
Destination: &settings.NoVerify,
|
2022-11-29 09:40:42 +00:00
|
|
|
Value: false,
|
2022-11-27 13:33:39 +00:00
|
|
|
Category: category,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|