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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user