diff --git a/main.go b/main.go index a1e6f49..cc0f4c6 100644 --- a/main.go +++ b/main.go @@ -143,6 +143,12 @@ func main() { Usage: "commit message", EnvVar: "DRONE_COMMIT_MESSAGE", }, + cli.StringFlag{ + Name: "source.branch", + Value: "develop", + Usage: "git source branch", + EnvVar: "DRONE_SOURCE_BRANCH", + }, cli.StringFlag{ Name: "build.event", Value: "push", @@ -251,6 +257,9 @@ func run(c *cli.Context) error { Avatar: c.String("commit.author.avatar"), Message: c.String("commit.message"), }, + Source: Source{ + Branch: c.String("source.branch"), + }, Build: Build{ Tag: c.String("build.tag"), Number: c.Int("build.number"), diff --git a/plugin.go b/plugin.go index b81d43a..52466ec 100644 --- a/plugin.go +++ b/plugin.go @@ -52,6 +52,10 @@ type ( Message string } + Source struct { + Branch string + } + // Build information. Build struct { Tag string @@ -121,6 +125,7 @@ type ( GitHub GitHub Repo Repo Build Build + Source Source Config Config Payload Payload Commit Commit diff --git a/plugin_test.go b/plugin_test.go index 68bf3e8..b187518 100644 --- a/plugin_test.go +++ b/plugin_test.go @@ -34,6 +34,9 @@ func TestTemplate(t *testing.T) { Link: "https://github.com/appleboy/go-hello", Event: "tag", }, + Source: Source{ + Branch: "feature/awesome-feature", + }, Config: Config{ WebhookID: os.Getenv("WEBHOOK_ID"),