* Chore: Improve levitate CI PR messaage * Temporary disable the skip * Remove ignore * Add an artificial breaking change * Restore * Restore * Trigger breaking change (maybe?) * --wip-- [skip ci] * Empty commit * Keep trying * Breaking change maybe? * Add levitate markdown to persistent output * Move markdown output * no skipping * Force run * remove skip * Try * Fix workflow * tryu * fix typo * remove duplicated id * Test * Invert commands * Fix script * Do not output the markdown directly * Try 2 * Try with base64 * Update message * Update message * Fix base64 encoding * Update report * Fix * test file * Try without base64 * Fix report to not use base64 * restore skip file * revert breaking changes * Empty commit
29 lines
779 B
JavaScript
29 lines
779 B
JavaScript
const fs = require('fs');
|
|
|
|
const data = JSON.parse(fs.readFileSync('data.json', 'utf8'));
|
|
|
|
const stripAnsi = (string) => string.replace(/\u001b\[.*?m/g, '');
|
|
|
|
const printSection = (title, items) => {
|
|
let output = `### ${title}\n\n`;
|
|
items.forEach((item) => {
|
|
output += `**${item.name}**\n`;
|
|
output += `<sub>${item.location}</sub>\n\n`;
|
|
output += '```' + (item.declaration ? 'typescript' : 'diff typescript') + '\n';
|
|
output += item.declaration ? item.declaration : stripAnsi(item.diff);
|
|
output += '\n```\n\n';
|
|
});
|
|
return output;
|
|
};
|
|
|
|
let markdown = '';
|
|
|
|
if (data.removals.length > 0) {
|
|
markdown += printSection('Removals', data.removals);
|
|
}
|
|
if (data.changes.length > 0) {
|
|
markdown += printSection('Changes', data.changes);
|
|
}
|
|
|
|
console.log(markdown);
|