UPDATE
Had another look – here is one route through JavaScript for Automation. A bit circuitous – writes out the plist and then modifies it.
FWIW a JS variant on Chris's theme:
Paste Dated Attribution Action (with JS).kmmacros (5.3 KB)

function run() {
// ISOLocal :: Date -> String
function ISOLocal(dte) {
var xs = ['FullYear', 'Month', 'Date',
'Hours', 'Minutes', 'Seconds'
]
.map(function (k, i) {
var n = dte['get' + k](),
s = (n + (i === 1 ? 1 : 0))
.toString();
return (s.length === 1 ? '0' : '') + s;
});
return xs.slice(0, 3)
.join('-') + ' ' + xs.slice(3)
.join(':')
}
// readFile :: FilePath -> maybe String
function readFile(strPath) {
var error = $(),
str = ObjC.unwrap(
$.NSString.stringWithContentsOfFileEncodingError(
$(strPath)
.stringByStandardizingPath,
$.NSUTF8StringEncoding,
error
)
);
return error.code || str;
}
var strNow = ISOLocal(new Date()),
strPath = '~/Library/Caches/TemporaryItems/kmImportAction.kmactions',
dctAction = {
ActionColor: 'Aqua',
ActionName: 'A Macro by Your Name <Your EmailAddress>',
MacroActionType: 'Comment',
Text: 'Authored by Your Name <Your Email Address>\n' +
strNow + ' : Created\n' +
strNow + ' : Modified'
},
// GENERATE THE DEFAULT PLIST XML
strXML = (
$.NSDictionary
.dictionaryWithDictionary(dctAction)
.writeToFileAtomically(
$(strPath)
.stringByStandardizingPath, true
),
readFile(strPath)
),
// ADJUST THE XML (wrap <dict> in <array>) FOR KM
// Read back into an NSXMLDOCUMENT
docXML = $.NSXMLDocument.alloc.initWithXMLStringOptionsError(
strXML, 0, null
),
xmlRoot = docXML.rootElement,
// Add a top level <array> element
xmlArray = (
xmlRoot.insertChildAtIndex(
$.NSXMLElement.alloc.initWithName('array'), 0
),
xmlRoot.childAtIndex(0)
);
// Place a copy of the <dict> inside the <array>
xmlArray.addChild(
xmlRoot.childAtIndex(1)
.copy
);
// and remove the original copy of the <dict>
xmlRoot.removeChildAtIndex(1);
// Then write the file back out again
return docXML.XMLData
.writeToFileAtomically(
$(strPath)
.stringByStandardizingPath, true
);
}