Skip to content

Commit ed9aebe

Browse files
committed
prevent release body too long
1 parent 9982340 commit ed9aebe

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

.github/workflows/build-and-release.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,41 +94,41 @@ jobs:
9494
- name: Prepare release body with font check results
9595
run: |
9696
REPORT_PATH="sources/output/report.md"
97+
REPORT_TXT="sources/output/fontbakery-report.txt"
9798
RELEASE_NOTES="sources/output/release_notes.md"
9899
99100
if [ ! -f "$REPORT_PATH" ]; then
100101
echo "Fontbakery report missing at $REPORT_PATH" > "$RELEASE_NOTES"
101102
echo "RELEASE_BODY_PATH=$RELEASE_NOTES" >> $GITHUB_ENV
103+
echo "REPORT_TXT=" >> $GITHUB_ENV
102104
exit 0
103105
fi
104106
105-
echo "Fonts generated from commit $GITHUB_SHA." > "$RELEASE_NOTES"
106-
echo "Download the .ttf files from the assets below." >> "$RELEASE_NOTES"
107-
echo "" >> "$RELEASE_NOTES"
108-
echo "## Fontbakery checks" >> "$RELEASE_NOTES"
107+
cp "$REPORT_PATH" "$REPORT_TXT"
108+
109+
echo "Fontbakery failure summary (max 1000 chars)." > "$RELEASE_NOTES"
109110
110111
if grep -Ei 'FAIL|❌|:x:' "$REPORT_PATH" > /tmp/fail_lines.txt; then
111-
echo "**Status: Failures detected.**" >> "$RELEASE_NOTES"
112-
echo "" >> "$RELEASE_NOTES"
113-
echo "### Failed checks" >> "$RELEASE_NOTES"
114-
cat /tmp/fail_lines.txt >> "$RELEASE_NOTES"
115112
echo "" >> "$RELEASE_NOTES"
113+
perl -0777 -ne 'print substr($_, 0, 1000)' /tmp/fail_lines.txt >> "$RELEASE_NOTES"
116114
else
117-
echo "**Status: No FAIL results reported.**" >> "$RELEASE_NOTES"
118-
echo "" >> "$RELEASE_NOTES"
115+
echo "No FAIL results reported." >> "$RELEASE_NOTES"
119116
fi
120117
121-
echo "### Full Fontbakery report" >> "$RELEASE_NOTES"
122-
cat "$REPORT_PATH" >> "$RELEASE_NOTES"
118+
# Ensure the entire body stays within 1000 characters
119+
perl -0777 -i -ne 'print substr($_, 0, 1000)' "$RELEASE_NOTES"
123120
124121
echo "RELEASE_BODY_PATH=$RELEASE_NOTES" >> $GITHUB_ENV
122+
echo "REPORT_TXT=$REPORT_TXT" >> $GITHUB_ENV
125123
126124
# Create a release and upload fonts
127125
- name: Create Release
128126
id: create_release
129127
uses: softprops/action-gh-release@v1
130128
with:
131-
files: sources/output/*.zip
129+
files: |
130+
sources/output/*.zip
131+
${{ env.REPORT_TXT }}
132132
name: Font Build - ${{ github.sha }}
133133
body_path: ${{ env.RELEASE_BODY_PATH }}
134134
draft: false

0 commit comments

Comments
 (0)