Update the DIY docs script in ready-for-doc-review to use the GitHub CLI (#54951)
This commit is contained in:
28
.github/workflows/ready-for-doc-review.yml
vendored
28
.github/workflows/ready-for-doc-review.yml
vendored
@@ -51,31 +51,21 @@ jobs:
|
||||
run: |
|
||||
echo "Extracting issue numbers from PR description..."
|
||||
|
||||
# Clean up PR description to avoid syntax errors in grep command
|
||||
PR_BODY="${{ 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"
|
||||
# Get issue numbers directly using gh pr view
|
||||
ISSUE_NUMS=$(gh pr view ${{ github.event.pull_request.number }} --json body -q .body | \
|
||||
grep -oE '(https://github.com/github/docs-content/issues/[0-9]+|github/docs-content#[0-9]+|#[0-9]+)' | \
|
||||
grep -oE '[0-9]+$' || echo "")
|
||||
echo "Extracted docs-content issue numbers: $ISSUE_NUMS"
|
||||
|
||||
if [ -n "$ISSUE_NUMS" ]; then
|
||||
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..."
|
||||
if gh issue view $ISSUE_NUM --repo github/docs-content --json labels > /dev/null 2>&1; then
|
||||
echo "Issue $ISSUE_NUM exists in docs-content. Fetching labels..."
|
||||
# Fetch labels for the issue
|
||||
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 "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
|
||||
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
|
||||
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
|
||||
done
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user