1 Commits
v0.1 ... v0.0.2

Author SHA1 Message Date
Riley Snyder
a8d4a08f79 feat: expose actor argument (#9) 2023-01-11 10:40:40 +05:30
2 changed files with 13 additions and 0 deletions

View File

@@ -81,6 +81,11 @@ func main() {
Usage: "Webhook event payload",
EnvVar: "PLUGIN_EVENT_PAYLOAD",
},
cli.StringFlag{
Name: "actor",
Usage: "User that triggered the event",
EnvVar: "PLUGIN_ACTOR",
},
// daemon flags
cli.StringFlag{
@@ -179,6 +184,7 @@ func run(c *cli.Context) error {
Verbose: c.Bool("action-verbose"),
Image: c.String("action-image"),
EventPayload: c.String("event-payload"),
Actor: c.String("actor"),
},
Daemon: daemon.Daemon{
Registry: c.String("docker.registry"),

View File

@@ -30,6 +30,7 @@ type (
Env map[string]string
Image string
EventPayload string // Webhook event payload
Actor string
Verbose bool
}
@@ -67,6 +68,12 @@ func (p Plugin) Exec() error {
"--detect-event",
}
// optional arguments
if p.Action.Actor != "" {
cmdArgs = append(cmdArgs, "--actor")
cmdArgs = append(cmdArgs, p.Action.Actor)
}
if p.Action.EventPayload != "" {
if err := ioutil.WriteFile(eventPayloadFile, []byte(p.Action.EventPayload), 0644); err != nil {
return errors.Wrap(err, "failed to write event payload to file")