fix: fix template context and default template

This commit is contained in:
Robert Kaussow 2021-09-19 15:34:14 +02:00
parent ea81ac130e
commit 3fd2dfdafa
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
2 changed files with 2 additions and 2 deletions

View File

@ -55,7 +55,7 @@ func settingsFlags(settings *plugin.Settings) []cli.Flag {
Name: "template", Name: "template",
EnvVars: []string{"PLUGIN_TEMPLATE", "MATRIX_TEMPLATE"}, EnvVars: []string{"PLUGIN_TEMPLATE", "MATRIX_TEMPLATE"},
Usage: "sets message 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, Destination: &settings.Template,
}, },
} }

View File

@ -62,7 +62,7 @@ func (p *Plugin) Execute() error {
return fmt.Errorf("failed to join room: %w", err) 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 { if err != nil {
return fmt.Errorf("failed to render template: %w", err) return fmt.Errorf("failed to render template: %w", err)