Skip to content

Commit a897b75

Browse files
authored
Bug fix: DIY docs label workflow, clean up PR description before using grep command (#54944)
1 parent 8c78a30 commit a897b75

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

.github/workflows/ready-for-doc-review.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,12 @@ jobs:
5050
GITHUB_TOKEN: ${{ secrets.DOCS_BOT_PAT_WRITEORG_PROJECT }}
5151
run: |
5252
echo "Extracting issue numbers from PR description..."
53-
ISSUE_NUMS=$(echo "${{ github.event.pull_request.body }}" | grep -oE '(https://github.com/github/docs-content/issues/[0-9]+|github/docs-content#[0-9]+|#[0-9]+)' | grep -oE '[0-9]+$')
53+
54+
# Clean up PR description to avoid syntax errors in grep command
55+
PR_BODY=$(printf '%q' "${{ github.event.pull_request.body }}")
56+
echo "PR description to use in the script: $PR_BODY"
57+
58+
ISSUE_NUMS=$(echo "$PR_BODY" | grep -oE '(https://github.com/github/docs-content/issues/[0-9]+|github/docs-content#[0-9]+|#[0-9]+)' | grep -oE '[0-9]+$')
5459
echo "Extracted issue numbers: $ISSUE_NUMS"
5560
5661
if [ -n "$ISSUE_NUMS" ]; then
@@ -67,7 +72,7 @@ jobs:
6772
echo "DIY_DOCS_LABEL=true" >> $GITHUB_ENV
6873
break
6974
else
70-
echo "DIY docs label not found for issue #$ISSUE_NUM."
75+
echo "DIY docs label not found for issue $ISSUE_NUM."
7176
fi
7277
else
7378
echo "Issue $ISSUE_NUM does not exist in the docs-content repository."

0 commit comments

Comments
 (0)