drone-slack icon indicating copy to clipboard operation
drone-slack copied to clipboard

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

Open waterdrop01 opened this issue 3 years ago • 2 comments

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!

waterdrop01 avatar Jul 06 '21 19:07 waterdrop01

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.

ErvalhouS avatar Dec 10 '21 13:12 ErvalhouS

has someone solved this issue or has a workaround?

divramod avatar Aug 04 '23 06:08 divramod