Skip to content

Commit ab89d0b

Browse files
committed
Update draftlog check to fail on leading whitespace
1 parent b51e839 commit ab89d0b

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎.github/workflows/check-draftlog.yml‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,28 @@ jobs:
6464
fi
6565
6666
MISSING_LINK=""
67+
LEADING_SPACE=""
6768
while IFS= read -r f; do
6869
[ -z "$f" ] && continue
6970
content=$(gh api -H 'Accept: application/vnd.github.raw' "/repos/$REPO/contents/$f?ref=$HEAD_SHA")
7071
if ! echo "$content" | grep -qE "\[\[#${PR_NUMBER}\]\(https://github\.com/plotly/plotly\.js/(pull|issues)/${PR_NUMBER}\)\]"; then
7172
MISSING_LINK="$MISSING_LINK$f"$'\n'
7273
fi
74+
# The first line is the top-level entry. Later lines can need indentation.
75+
if echo "$content" | head -n 1 | grep -qE '^[[:space:]]'; then
76+
LEADING_SPACE="$LEADING_SPACE$f"$'\n'
77+
fi
7378
done <<< "$ADDED"
7479
80+
if [ -n "$LEADING_SPACE" ]; then
81+
echo "::error::Draftlog entry(ies) with leading whitespace on the first line:"
82+
printf '%s' "$LEADING_SPACE" | sed 's/^/ - /'
83+
echo ""
84+
echo "Start the first line with '- ' and no leading whitespace."
85+
echo "See draftlogs/README.md for an example."
86+
exit 1
87+
fi
88+
7589
if [ -n "$MISSING_LINK" ]; then
7690
echo "::error::Draftlog entry(ies) missing a link to this PR (#${PR_NUMBER}):"
7791
printf '%s' "$MISSING_LINK" | sed 's/^/ - /'

0 commit comments

Comments
 (0)