It should be something like this:
Lua Code:
local actionName = "BMR_GOLD_TRANSFER"
local layerIndex, categoryIndex, actionIndex = GetActionIndicesFromName(actionName)
local bindingIndex = 1 --1 or 2, primary or secondary binding
local keyCode, mod1, mod2, mod3, mod4 = GetActionBindingInfo(layerIndex, categoryIndex, actionIndex, bindingIndex)
--I assume that you use bindings without modifier keys (ALT, CTRL, SHIFT, COMMAND), so this example uses just keyCode
d(zo_strformat("Action |cFFFFFF<<1>>|r is bound to |cFFFFFF<<2>>|r.", actionName, GetKeyName(keyCode)))
Or you can use a bit more complex function defined in the UI which prints also modifier keys (I'd prefer this method):
Lua Code:
local actionName = "BMR_GOLD_TRANSFER"
--KEYBIND_TEXT_OPTIONS_ABBREVIATED_NAME = 1
--KEYBIND_TEXT_OPTIONS_FULL_NAME = 2
--KEYBIND_TEXT_OPTIONS_FULL_NAME_SEPARATE_MODS = 3
local textOptions = KEYBIND_TEXT_OPTIONS_ABBREVIATED_NAME
--KEYBIND_TEXTURE_OPTIONS_NONE = 1
--KEYBIND_TEXTURE_OPTIONS_EMBED_MARKUP = 2
local textureOptions = KEYBIND_TEXTURE_OPTIONS_NONE
local bindingIndex = 1 --1 or 2, primary or secondary binding
local bindingString = ZO_Keybindings_GetBindingStringFromAction(actionName, textOptions, textureOptions, bindingIndex)
d(zo_strformat("Action |cFFFFFF<<1>>|r is bound to |cFFFFFF<<2>>|r.", actionName, bindingString))