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

Update the DIY docs script in ready-for-doc-review to use the GitHub CLI (#54951)

This commit is contained in:
Joe Clark
2025-03-21 14:47:51 -07:00
committed by GitHub
parent caf85b9a04
commit c6c4765697

View File

@@ -51,31 +51,21 @@ jobs:
run: | run: |
echo "Extracting issue numbers from PR description..." echo "Extracting issue numbers from PR description..."
# Clean up PR description to avoid syntax errors in grep command # Get issue numbers directly using gh pr view
PR_BODY="${{ github.event.pull_request.body }}" ISSUE_NUMS=$(gh pr view ${{ github.event.pull_request.number }} --json body -q .body | \
echo "PR description to use in the script: $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 "")
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 docs-content issue numbers: $ISSUE_NUMS"
echo "Extracted issue numbers: $ISSUE_NUMS"
if [ -n "$ISSUE_NUMS" ]; then if [ -n "$ISSUE_NUMS" ]; then
for ISSUE_NUM in $ISSUE_NUMS; do for ISSUE_NUM in $ISSUE_NUMS; do
# Check if the issue exists in the docs-content repository echo "Checking issue #$ISSUE_NUM in the docs-content repository..."
echo "Checking issue $ISSUE_NUM in the docs-content repository..." if gh issue view $ISSUE_NUM --repo github/docs-content --json labels -q '.labels[].name' | grep -q 'DIY docs'; then
if gh issue view $ISSUE_NUM --repo github/docs-content --json labels > /dev/null 2>&1; then echo "DIY docs label found for issue #$ISSUE_NUM."
echo "Issue $ISSUE_NUM exists in docs-content. Fetching labels..." echo "DIY_DOCS_LABEL=true" >> $GITHUB_ENV
# Fetch labels for the issue break
LABELS=$(gh issue view $ISSUE_NUM --repo github/docs-content --json labels --jq '.labels[].name' || echo "")
echo "Labels for issue $ISSUE_NUM: $LABELS"
if echo "$LABELS" | grep -q 'DIY docs'; then
echo "DIY docs label found for issue $ISSUE_NUM."
echo "DIY_DOCS_LABEL=true" >> $GITHUB_ENV
break
else
echo "DIY docs label not found for issue $ISSUE_NUM."
fi
else else
echo "Issue $ISSUE_NUM does not exist in the docs-content repository." echo "Issue #$ISSUE_NUM exists but does not have the DIY docs label."
fi fi
done done
else else