mirror of
https://github.com/appleboy/drone-discord.git
synced 2026-06-04 10:23:47 +08:00
docs: update notification docs for Woodpecker 3.x status changes (#65)
* docs: update notification docs for Woodpecker 3.x status changes - Add documentation note explaining that in Woodpecker 3.x, build.status is always "success", which affects message templates - Recommend using the when.status condition to separate success and failure notifications, with example YAML provided - Clarify that this issue results from upstream Woodpecker CI changes and is not fixable in the plugin Signed-off-by: appleboy <appleboy.tw@gmail.com> * Update DOCS.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Signed-off-by: appleboy <appleboy.tw@gmail.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
@@ -197,3 +197,31 @@ urlencode
|
|||||||
|
|
||||||
since
|
since
|
||||||
: returns a duration string between now and the given timestamp. Example `{{since build.started}}`
|
: returns a duration string between now and the given timestamp. Example `{{since build.started}}`
|
||||||
|
|
||||||
|
## Note for Woodpecker 3.x Users
|
||||||
|
|
||||||
|
Starting with Woodpecker 3.x, the `build.status` variable is always set to `success`, which means message templates cannot correctly distinguish between success and failure. It is recommended to use the `when.status` condition to split notifications for success and failure, as shown below:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: discord success notification
|
||||||
|
when:
|
||||||
|
status: [ success ]
|
||||||
|
image: appleboy/drone-discord
|
||||||
|
settings:
|
||||||
|
webhook_id: xxxxxxxxxx
|
||||||
|
webhook_token: xxxxxxxxxx
|
||||||
|
message: >
|
||||||
|
build {{build.number}} succeeded. Good job.
|
||||||
|
|
||||||
|
- name: discord failure notification
|
||||||
|
when:
|
||||||
|
status: [ failure ]
|
||||||
|
image: appleboy/drone-discord
|
||||||
|
settings:
|
||||||
|
webhook_id: xxxxxxxxxx
|
||||||
|
webhook_token: xxxxxxxxxx
|
||||||
|
message: >
|
||||||
|
build {{build.number}} failed. Fix me please.
|
||||||
|
```
|
||||||
|
|
||||||
|
This is due to a change in Woodpecker CI behavior and cannot be fixed on the plugin side. Please use the above workaround for correct notifications.
|
||||||
|
|||||||
Reference in New Issue
Block a user