From 3fd2dfdafacc8326f0ef1d14b059de593236709b Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 19 Sep 2021 15:34:14 +0200 Subject: [PATCH] fix: fix template context and default template --- cmd/drone-matrix/config.go | 2 +- plugin/impl.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/drone-matrix/config.go b/cmd/drone-matrix/config.go index 5d1fc56..edd31e9 100644 --- a/cmd/drone-matrix/config.go +++ b/cmd/drone-matrix/config.go @@ -55,7 +55,7 @@ func settingsFlags(settings *plugin.Settings) []cli.Flag { Name: "template", EnvVars: []string{"PLUGIN_TEMPLATE", "MATRIX_TEMPLATE"}, Usage: "sets message template", - Value: "Build {{ build.status }} [{{ repo.Owner }}/{{ repo.Name }}#{{ truncate build.commit 8 }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}", + Value: "Build {{ build.Status }} [{{ repo.Owner }}/{{ repo.Name }}#{{ truncate commit.SHA 8 }}]({{ build.Link }}) ({{ build.Branch }}) by {{ commit.Author }}", Destination: &settings.Template, }, } diff --git a/plugin/impl.go b/plugin/impl.go index 7d22197..a240b54 100644 --- a/plugin/impl.go +++ b/plugin/impl.go @@ -62,7 +62,7 @@ func (p *Plugin) Execute() error { return fmt.Errorf("failed to join room: %w", err) } - message, err := template.RenderTrim(p.settings.Template, p) + message, err := template.RenderTrim(p.settings.Template, p.pipeline) if err != nil { return fmt.Errorf("failed to render template: %w", err)