1
0
mirror of synced 2025-12-19 18:10:59 -05:00

Bug fix: DIY docs label workflow, clean up PR description before using grep command (#54944)

This commit is contained in:
Joe Clark
2025-03-20 15:26:24 -07:00
committed by GitHub
parent 8c78a30c2f
commit a897b754cf

View File

@@ -50,7 +50,12 @@ jobs:
GITHUB_TOKEN: ${{ secrets.DOCS_BOT_PAT_WRITEORG_PROJECT }} GITHUB_TOKEN: ${{ secrets.DOCS_BOT_PAT_WRITEORG_PROJECT }}
run: | run: |
echo "Extracting issue numbers from PR description..." echo "Extracting issue numbers from PR description..."
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]+$')
# Clean up PR description to avoid syntax errors in grep command
PR_BODY=$(printf '%q' "${{ github.event.pull_request.body }}")
echo "PR description to use in the script: $PR_BODY"
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]+$')
echo "Extracted issue numbers: $ISSUE_NUMS" echo "Extracted issue numbers: $ISSUE_NUMS"
if [ -n "$ISSUE_NUMS" ]; then if [ -n "$ISSUE_NUMS" ]; then
@@ -67,7 +72,7 @@ jobs:
echo "DIY_DOCS_LABEL=true" >> $GITHUB_ENV echo "DIY_DOCS_LABEL=true" >> $GITHUB_ENV
break break
else else
echo "DIY docs label not found for issue #$ISSUE_NUM." echo "DIY docs label not found for issue $ISSUE_NUM."
fi fi
else else
echo "Issue $ISSUE_NUM does not exist in the docs-content repository." echo "Issue $ISSUE_NUM does not exist in the docs-content repository."