Change entity script action_name

Hi, is it possible to change action_name with the same status as card_mode icon

I try this but it doesn’t work.

action_name: >
   {% if is_state('alarm_control_panel.partition_mama','armed_away')%} Name {% else %} name2 {% endif %}

Code

type: entities
entities:
  - entity: script.lights
    name: Lights
    action_name: I need change this
    card_mod:
      style: |
        :host {
          {% if is_state('alarm_control_panel.partition_mama','armed_away')%}
            --card-mod-icon-color: var(--state-input_boolean-on-color, var(--state-input_boolean-active-color, var(--state-active-color)));
          {% else %}
            --card-mod-icon-color: var(--paper-item-icon-color,#44739e);
          {% endif %}
        }
state_color: true

No, you can’t template that. Use conditional rows — here’s an example from my system which appears to show different action_names but is actually showing one of two lines.

          - type: entities
            entities:
              - type: conditional
                conditions:
                  - entity: input_boolean.schedule_override
                    state: 'off'
                row:
                  entity: input_boolean.schedule_override
                  type: button
                  name: Override schedule
                  action_name: Charge now
              - type: conditional
                conditions:
                  - entity: input_boolean.schedule_override
                    state: 'on'
                row:
                  entity: input_boolean.schedule_override
                  type: button
                  name: Override schedule
                  action_name: Stop charge

Interesting choice, and what about state?

Or maybe possible create template to the configuration.yml?