mirror of
https://github.com/appleboy/drone-telegram.git
synced 2026-06-04 10:14:50 +08:00
Option to load tempate variables from json file (#98)
This commit is contained in:
@@ -186,6 +186,33 @@ Build finished for *{{tpl.app}}* - *{{tpl.env}}*
|
||||
{{/success}}
|
||||
```
|
||||
|
||||
Example configuration with a custom message template, with extra vars loaded from file (e.g. from previous build steps):
|
||||
|
||||
```diff
|
||||
- name: send telegram notification
|
||||
image: appleboy/drone-telegram
|
||||
settings:
|
||||
token: xxxxxxxxxx
|
||||
to: telegram_user_id
|
||||
+ template_vars_file: build_report.json
|
||||
+ message: >
|
||||
+ {{#success build.status}}
|
||||
+ build {{build.number}} succeeded, artefact version = {{tpl.artefact_version}}.
|
||||
+ {{else}}
|
||||
+ build {{build.number}} failed. Fix me please.
|
||||
+ {{/success}}
|
||||
```
|
||||
|
||||
Where `build_report.json` is:
|
||||
|
||||
```
|
||||
{
|
||||
...
|
||||
"artefact_version": "0.2.3452"
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Example configuration with a custom socks5 URL:
|
||||
|
||||
```diff
|
||||
@@ -215,6 +242,9 @@ message_file
|
||||
template_vars
|
||||
: define additional template vars. Example: `var1: hello` can be used within the template as `tpl.var1`
|
||||
|
||||
template_vars_file
|
||||
: load additional template vars from json file. Example: given file content `{"var1":"hello"}`, variable can be used within the template as `tpl.var1`
|
||||
|
||||
photo
|
||||
: local file path
|
||||
|
||||
|
||||
Reference in New Issue
Block a user