sarisia/actions-status-discord

Have a way to override the `fields` embed (or at least the `eventDetail` part of the fields)

Closed this issue · 1 comments

Hi !

It would be cool if there was a way to override the fields part of the embed.

I really like the display of the message when using fields but, sometimes, the eventDetail part is huge (when squash merging a PR with lots of commits, github's default is to append all the commit message to the merge commit message).

Currently, there is no way to reproduce the display of what the fields embed do and passing nocontext remove the fields entirely.

What do you think about adding an option which, when provided, override the eventDetail value ?


Something event more flexible would be to be able to pass an option with the entire fields array but I'm not sure if it's possible to passe something like:

with:
  fields: ${{ fromJSON('[{"name":"Repository","value":"...","inline":true},{"name":"Ref","value":"...","inline":true},{"name":"Event","value":"...","inline":false},{"name":"Triggered by","value":"...","inline":true},{"name":"Workflow","value":"...","inline":true}]') }}

Hi, thank you for raising feature request and sorry for my super late reply.

I think having customizations for embed fields is great!
If going this way, I'd like to have the design below:

  • we won't add new options to disable eventDetail, since there's so many noxxx options currently (yeah this sucks sorry) and adding this makes users harder to understand each options' effect

  • having fields options, accepts json or yaml inputs

    • by default, fields will be appended to default fields generated by this action and if nocontext or nodetail is specified, only default fields will be omitted and custom fields in fields option remain.

    • usages like:

      with:
        fields: |
          [
            {
              "name": "Additional Field 1",
              "value": "value1",
              "inline": "true"
            },
            {
              "name": "Additional Field 2",
              "value": "value2",
              "inline": "false"
            }
          ]

      or yaml:

      with:
        fields: |
          - name: Additional Field 1
            value: value1
            inline: true
          - name: Additional Field 2
            value: value2
            inline: false

    (FYI, fromJSON won't work here. Actions always receives option value as string.)

What do you think about this?
Also, sorry to say but I'm not sure when I can get to work on this. Pull requests are greatly appreciated, thanks!