appleboy / drone-discord

Drone plugin for sending message to Discord channel using Webhook
MIT License
35 stars 20 forks source link

build.branch/message/author not working #33

Open Rinma opened 3 years ago

Rinma commented 3 years ago

Hi.

I have the following problem with build variables not showing in the message.

Config:

message: >
      {{#success build.status}}
        build {{build.number}} succeeded.
      {{else}}
        build {{build.number}} failed.  
        Changes: {{build.branch}} / {{build.message}} from {{build.author}}.  
        See: {{build.link}}
      {{/success}}

Message on discord:

build 126 failed.
  Changes:  /  from .
  See: https://drone.example.org/Group/Project/126

The job on drone: grafik

Rinma commented 3 years ago

Found the problem. Message needs to look like this:

message: >
      {{#success build.status}}
        build {{build.number}} succeeded.
      {{else}}
        build {{build.number}} failed.  
        Changes: {{commit.branch}} / {{commit.message}} from {{commit.author}}.  
        See: {{build.link}}
      {{/success}}

https://github.com/appleboy/drone-discord/blob/master/DOCS.md needs an updated.

lukethegeek commented 3 years ago

I just encountered this. It looks like changes have been made to the template variables (build > commit) however the drone plugin documentation template reference and examples at http://plugins.drone.io/appleboy/drone-discord/ need updating to match.

golyalpha commented 3 years ago

repo.owner also doesn't work (at least if repo is owned by a gitea group) And build.started is weirdly buggy when combined with the since function (sometimes it shows the duration of the Discord step, other times it shows the duration of the entire build)

And not sure if this is Drone's fault or not, but commit.message outputs certain characters as character entities (for example ') which Discord does not render properly.