@@ -51,31 +51,21 @@ jobs:
51
51
run : |
52
52
echo "Extracting issue numbers from PR description..."
53
53
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"
60
59
61
60
if [ -n "$ISSUE_NUMS" ]; then
62
61
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
77
67
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 ."
79
69
fi
80
70
done
81
71
else
0 commit comments