Chore: Improve levitate comment output (#79749)

* Test removing the icon component

* Use different component

* Replace \n with <br>

* Fix formatting

* Empty commit

* Improve formatting

* Fix breaking lines format

* Remove output

* Remove breaking change
This commit is contained in:
Esteban Beltran 2023-12-20 13:40:47 +01:00 committed by GitHub
parent ae3cb8231b
commit 234ccb886f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 10 deletions

View File

@ -37,16 +37,13 @@ while IFS=" " read -r -a package; do
# Check if the comparison returned with a non-zero exit code
# Record the output, maybe with some additional information
STATUS=$?
CURRENT_REPORT=$(node ./scripts/levitate-parse-json-report.js)
echo $CURRENT_REPORT
# Final exit code
# (non-zero if any of the packages failed the checks)
if [ $STATUS -gt 0 ]; then
EXIT_CODE=1
GITHUB_MESSAGE="${GITHUB_MESSAGE}**\\\`${PACKAGE_PATH}\\\`** has possible breaking changes ([more info](${GITHUB_JOB_LINK}#step:${GITHUB_STEP_NUMBER}:1))<br />"
GITHUB_LEVITATE_MARKDOWN+="##${PACKAGE_PATH}\n${CURRENT_REPORT}\n"
GITHUB_LEVITATE_MARKDOWN+="<h3>${PACKAGE_PATH}</h3>${CURRENT_REPORT}<br>"
fi
done <<<"$PACKAGES"

View File

@ -5,13 +5,14 @@ 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`;
let output = `<h4>${title}</h4>`;
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';
const language = item.declaration ? 'typescript' : 'diff';
const code = item.declaration ? item.declaration : stripAnsi(item.diff);
output += `<b>${item.name}</b><br>`;
output += `<sub>${item.location}</sub><br>`;
output += `<pre lang="${language}">${code}</pre><br>`;
});
return output;
};