mirror of
https://github.com/appleboy/drone-ssh.git
synced 2025-05-09 18:23:21 +08:00
Add support for passing commands via a file
This commit is contained in:
parent
dc927a6123
commit
d88890e2bc
13
main.go
13
main.go
@ -131,6 +131,11 @@ func main() {
|
||||
Usage: "execute single commands for github action",
|
||||
EnvVars: []string{"INPUT_SCRIPT"},
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "script.file",
|
||||
Usage: "execute commands from a file for github action",
|
||||
EnvVars: []string{"INPUT_SCRIPT_FILE"},
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "script.stop",
|
||||
Usage: "stop script after first failure",
|
||||
@ -271,6 +276,14 @@ func run(c *cli.Context) error {
|
||||
scripts = append(scripts, s)
|
||||
}
|
||||
|
||||
if f := c.String("script.file"); f != "" {
|
||||
s, err := os.ReadFile(f)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
scripts = append(scripts, string(s))
|
||||
}
|
||||
|
||||
plugin := Plugin{
|
||||
Config: Config{
|
||||
Key: c.String("ssh-key"),
|
||||
|
Loading…
Reference in New Issue
Block a user