From 2afff8242edd432c73a650b4e301a452c376e3ac Mon Sep 17 00:00:00 2001 From: Allen Houchins <32207388+allenhouchins@users.noreply.github.com> Date: Fri, 14 Feb 2025 14:10:34 -0600 Subject: [PATCH] Update dogfood-policy-updater-latest-macos.sh (#26351) Updated script to automatically add reviewers to the pull request that is created. --- .../dogfood-policy-updater-latest-macos.sh | 26 +++++++++++++++++++ .../lib/macos/policies/latest-macos.yml | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/scripts/dogfood-policy-updater-latest-macos.sh b/.github/scripts/dogfood-policy-updater-latest-macos.sh index 6cc8f729ab..c98077b166 100644 --- a/.github/scripts/dogfood-policy-updater-latest-macos.sh +++ b/.github/scripts/dogfood-policy-updater-latest-macos.sh @@ -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 diff --git a/it-and-security/lib/macos/policies/latest-macos.yml b/it-and-security/lib/macos/policies/latest-macos.yml index 997aa394af..d3b9f19402 100644 --- a/it-and-security/lib/macos/policies/latest-macos.yml +++ b/it-and-security/lib/macos/policies/latest-macos.yml @@ -1,5 +1,5 @@ - name: macOS - Operating system up to date - query: SELECT 1 FROM os_version WHERE version >= '15.3.1'; + query: SELECT 1 FROM os_version WHERE version >= '15.3'; critical: true description: Using an outdated macOS version risks exposure to security vulnerabilities and potential system instability. resolution: Please find time to run Software Update.  > System Settings > Software Update