drone-plugins / drone-slack

Drone plugin for sending Slack notifications
http://plugins.drone.io/drone-plugins/drone-slack
Apache License 2.0
62 stars 80 forks source link

{{ datetime }} => Evaluation error: Helper datetime called with argument 0 with type int64 but it should be float64 #123

Open waterdrop01 opened 3 years ago

waterdrop01 commented 3 years ago

Hello,

I try to use datetime in my .drone.yml:

- name: slack
    image: plugins/slack
    settings:
      webhook:
        from_secret: slack-drone-webhook
      channel: alert-drone
      link_names: true
      template: >
        {{#success build.status}}✅{{else}}🐞{{/success}} Build #{{build.number}} of {{repo.name}}@{{build.tag}}

        📝 `{{commit.message}}`
        🙇 {{commit.author}}

        🕐 {{datetime build.started "02.01.2006 15:04" "Europe/Berlin"}}

        🌐 {{build.link}}

but this produce the following error:

Screenshot from 2021-07-06 21-30-40

2021/07/06 19:22:25 Evaluation error: Helper datetime called with argument 0 with type int64 but it should be float64
Current node:
String{Value:'Europe/Berlin', Pos:207}

Any idea how to cast int64 to float64 in the template?

Thanks!

ErvalhouS commented 2 years ago

I'm facing the same issue: build.started is int64 and that function is expecting float64.

This makes this function unusable with those native time variables if we don't have a way to cast types or something.

divramod commented 1 year ago

has someone solved this issue or has a workaround?