Update dogfood-policy-updater-latest-macos.sh (#26351)

Updated script to automatically add reviewers to the pull request that
is created.
This commit is contained in:
Allen Houchins
2025-02-14 14:10:34 -06:00
committed by GitHub
parent f90c9a1a5e
commit 2afff8242e
2 changed files with 27 additions and 1 deletions
@@ -103,6 +103,32 @@ if [ "$policy_version_number" != "$latest_macos_version" ]; then
fi
echo "Pull request created successfully."
# Extract the pull request number from the response
pr_number=$(echo "$pr_response" | jq -r '.number')
if [ -z "$pr_number" ] || [ "$pr_number" == "null" ]; then
echo "Error: Failed to retrieve pull request number."
exit 1
fi
echo "Adding reviewers to PR #$pr_number..."
# Prepare the reviewers data payload
reviewers_data=$(jq -n --argjson reviewers '["allenhouchins","harrisonravazzolo"]' '{reviewers: $reviewers}')
# Request reviewers for the pull request
review_response=$(curl -s -X POST \
-H "Authorization: token $DOGFOOD_AUTOMATION_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
-d "$reviewers_data" \
"https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/pulls/$pr_number/requested_reviewers")
if echo "$review_response" | grep -q "errors"; then
echo "Error: Failed to add reviewers. Response: $review_response"
exit 1
fi
echo "Reviewers added successfully."
else
echo "No updates needed; the version is the same."
fi