Skip to content

Commit bcc8827

Browse files
committed
ci: Require PR number in file name, link for draftlogs
1 parent 34355d5 commit bcc8827

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

.github/workflows/check-draftlog.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ jobs:
5353
exit 1
5454
fi
5555
56-
INVALID_NAMES=$(echo "$ADDED" | grep -vE '^draftlogs/[0-9]+_(fix|add|remove|change|deprecate)\.md$' || true)
56+
INVALID_NAMES=$(echo "$ADDED" | grep -vE "^draftlogs/${PR_NUMBER}_(fix|add|remove|change|deprecate)\.md$" || true)
5757
if [ -n "$INVALID_NAMES" ]; then
5858
echo "::error::Invalid draftlog filename(s):"
5959
echo "$INVALID_NAMES" | sed 's/^/ - /'
6060
echo ""
61-
echo "Expected pattern: draftlogs/<number>_(fix|add|remove|change|deprecate).md"
61+
echo "Expected pattern: draftlogs/${PR_NUMBER}_(fix|add|remove|change|deprecate).md"
6262
echo "See draftlogs/README.md for details."
6363
exit 1
6464
fi
@@ -67,17 +67,17 @@ jobs:
6767
while IFS= read -r f; do
6868
[ -z "$f" ] && continue
6969
content=$(gh api -H 'Accept: application/vnd.github.raw' "/repos/$REPO/contents/$f?ref=$HEAD_SHA")
70-
if ! echo "$content" | grep -qE '\[\[#[0-9]+\]\(https://github\.com/plotly/plotly\.js/pull/[0-9]+\)\]'; then
70+
if ! echo "$content" | grep -qE "\[\[#${PR_NUMBER}\]\(https://github\.com/plotly/plotly\.js/(pull|issues)/${PR_NUMBER}\)\]"; then
7171
MISSING_LINK="$MISSING_LINK$f"$'\n'
7272
fi
7373
done <<< "$ADDED"
7474
7575
if [ -n "$MISSING_LINK" ]; then
76-
echo "::error::Draftlog entry(ies) missing a PR link:"
76+
echo "::error::Draftlog entry(ies) missing a link to this PR (#${PR_NUMBER}):"
7777
printf '%s' "$MISSING_LINK" | sed 's/^/ - /'
7878
echo ""
7979
echo "Each entry must include a link in the form:"
80-
echo " [[#1234](https://github.com/plotly/plotly.js/pull/1234)]"
80+
echo " [[#${PR_NUMBER}](https://github.com/plotly/plotly.js/pull/${PR_NUMBER})]"
8181
echo "See draftlogs/README.md for an example."
8282
exit 1
8383
fi

0 commit comments

Comments
 (0)