@@ -51,21 +51,31 @@ jobs:
5151 run : |
5252 echo "Extracting issue numbers from PR description..."
5353
54- # Get issue numbers directly using gh pr view
55- ISSUE_NUMS=$(gh pr view ${{ github.event.pull_request.number }} --json body -q .body | \
56- grep -oE '(https://github.com/github/docs-content/issues/[0-9]+|github/docs-content#[0-9]+|#[0-9]+)' | \
57- grep -oE '[0-9]+$' || echo "")
58- echo "Extracted docs-content issue numbers: $ISSUE_NUMS"
54+ # Clean up PR description to avoid syntax errors in grep command
55+ PR_BODY="${{ 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]+$')
59+ echo "Extracted issue numbers: $ISSUE_NUMS"
5960
6061 if [ -n "$ISSUE_NUMS" ]; then
6162 for ISSUE_NUM in $ISSUE_NUMS; do
62- echo "Checking issue #$ISSUE_NUM in the docs-content repository..."
63- if gh issue view $ISSUE_NUM --repo github/docs-content --json labels -q '.labels[].name' | grep -q 'DIY docs'; then
64- echo "DIY docs label found for issue #$ISSUE_NUM."
65- echo "DIY_DOCS_LABEL=true" >> $GITHUB_ENV
66- break
63+ # Check if the issue exists in the docs-content repository
64+ echo "Checking issue $ISSUE_NUM in the docs-content repository..."
65+ if gh issue view $ISSUE_NUM --repo github/docs-content --json labels > /dev/null 2>&1; then
66+ echo "Issue $ISSUE_NUM exists in docs-content. Fetching labels..."
67+ # Fetch labels for the issue
68+ LABELS=$(gh issue view $ISSUE_NUM --repo github/docs-content --json labels --jq '.labels[].name' || echo "")
69+ echo "Labels for issue $ISSUE_NUM: $LABELS"
70+ if echo "$LABELS" | grep -q 'DIY docs'; then
71+ echo "DIY docs label found for issue $ISSUE_NUM."
72+ echo "DIY_DOCS_LABEL=true" >> $GITHUB_ENV
73+ break
74+ else
75+ echo "DIY docs label not found for issue $ISSUE_NUM."
76+ fi
6777 else
68- echo "Issue # $ISSUE_NUM exists but does not have the DIY docs label ."
78+ echo "Issue $ISSUE_NUM does not exist in the docs-content repository ."
6979 fi
7080 done
7181 else
0 commit comments