Skip to content

Commit c6c4765

Browse files
authoredMar 21, 2025
Update the DIY docs script in ready-for-doc-review to use the GitHub CLI (#54951)
1 parent caf85b9 commit c6c4765

File tree

1 file changed

+11
-21
lines changed

1 file changed

+11
-21
lines changed
 

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

+11-21
Original file line numberDiff line numberDiff line change
@@ -51,31 +51,21 @@ jobs:
5151
run: |
5252
echo "Extracting issue numbers from PR description..."
5353
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"
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"
6059
6160
if [ -n "$ISSUE_NUMS" ]; then
6261
for ISSUE_NUM in $ISSUE_NUMS; do
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
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
7767
else
78-
echo "Issue $ISSUE_NUM does not exist in the docs-content repository."
68+
echo "Issue #$ISSUE_NUM exists but does not have the DIY docs label."
7969
fi
8070
done
8171
else

0 commit comments

Comments
 (0)
Failed to load comments.