0
0
mirror of https://github.com/thegeeklab/wp-matrix.git synced 2024-09-20 01:22:47 +02:00
wp-matrix/plugin/plugin.go

48 lines
1.1 KiB
Go
Raw Normal View History

2020-11-25 20:44:45 +01:00
// Copyright (c) 2020, the Drone Plugins project authors.
// Copyright (c) 2021, Robert Kaussow <mail@thegeeklab.de>
2020-11-25 20:44:45 +01:00
// Use of this source code is governed by an Apache 2.0 license that can be
// found in the LICENSE file.
package plugin
import (
wp "github.com/thegeeklab/wp-plugin-go/plugin"
2020-11-25 20:44:45 +01:00
)
//nolint:lll
const DefaultMessageTemplate = `
Status: **{{ .Pipeline.Status }}**
Build: [{{ .Repository.Slug }}]({{ .Pipeline.URL }}){{ if .Curr.Branch }} ({{ .Curr.Branch }}){{ end }} by {{ .Curr.Author.Name }}
Message: {{ .Curr.Title }}{{ if .Curr.URL }} ([source]({{ .Curr.URL }})){{ end }}
`
2023-08-21 11:36:07 +02:00
// Plugin implements provide the plugin.
2020-11-25 20:44:45 +01:00
type Plugin struct {
*wp.Plugin
Settings *Settings
2020-11-25 20:44:45 +01:00
}
// Settings for the plugin.
type Settings struct {
Username string
Password string
UserID string
AccessToken string
Homeserver string
RoomID string
Template string
TemplateUnsafe bool
}
func New(options wp.Options, settings *Settings) *Plugin {
p := &Plugin{}
options.Execute = p.run
p.Plugin = wp.New(options)
p.Settings = settings
return p
2020-11-25 20:44:45 +01:00
}