Levitate: fix markdown diff format (#81477)

* Add some fake breaking changes

* try to generate another breaking chnage

* Keep trying

* Update levitate script

* Add fake breaking changes

* Use latest

* Strip ansi

* Test

* Remove ansi stripping

* ClearAnsi again

* another regex

* Revert some changes used for testing

* Rename function

* Fix indentation in levitate workflow

* Remove test breaking changes

* Remove breaking changes

* Update actions

* Trigger breaking change

* restore file
This commit is contained in:
Esteban Beltran
2024-02-02 09:19:30 +01:00
committed by GitHub
parent 86b16ea62a
commit ea243b536c
3 changed files with 232 additions and 228 deletions
+4 -4
View File
@@ -30,9 +30,9 @@ while IFS=" " read -r -a package; do
# Run the comparison and record the exit code
echo ""
echo ""
echo "${PACKAGE_PATH}"
echo "$PACKAGE_PATH"
echo "================================================="
npm exec -- @grafana/levitate compare --prev "$PREV" --current "$CURRENT" --json >data.json
npm exec -- @grafana/levitate@latest compare --prev "$PREV" --current "$CURRENT" --json >data.json
# Check if the comparison returned with a non-zero exit code
# Record the output, maybe with some additional information
@@ -40,7 +40,7 @@ while IFS=" " read -r -a package; do
CURRENT_REPORT=$(node ./scripts/levitate-parse-json-report.js)
# Final exit code
# (non-zero if any of the packages failed the checks)
if [ $STATUS -gt 0 ]; then
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+="<h3>${PACKAGE_PATH}</h3>${CURRENT_REPORT}<br>"
@@ -52,7 +52,7 @@ done <<<"$PACKAGES"
echo "is_breaking=$EXIT_CODE" >>"$GITHUB_OUTPUT"
echo "message=$GITHUB_MESSAGE" >>"$GITHUB_OUTPUT"
mkdir -p ./levitate
echo $GITHUB_LEVITATE_MARKDOWN >./levitate/levitate.md
echo "$GITHUB_LEVITATE_MARKDOWN" >./levitate/levitate.md
# We will exit the workflow accordingly at another step
exit 0