From d1b7af49da5581454346d718cbec9f797d1e1572 Mon Sep 17 00:00:00 2001 From: Christian Clauss <cclauss@me.com> Date: Mon, 30 Sep 2024 11:38:17 +0200 Subject: [PATCH 1/3] Scripts for closing pull requests for Hacktoberfest --- ...ose_pull_requests_with_awaiting_changes.sh | 22 +++++++++++++++++++ .../close_pull_requests_with_failing_tests.sh | 22 +++++++++++++++++++ ...requests_with_require_descriptive_names.sh | 21 ++++++++++++++++++ .../close_pull_requests_with_require_tests.sh | 22 +++++++++++++++++++ ...e_pull_requests_with_require_type_hints.sh | 21 ++++++++++++++++++ 5 files changed, 108 insertions(+) create mode 100755 scripts/close_pull_requests_with_awaiting_changes.sh create mode 100755 scripts/close_pull_requests_with_failing_tests.sh create mode 100755 scripts/close_pull_requests_with_require_descriptive_names.sh create mode 100755 scripts/close_pull_requests_with_require_tests.sh create mode 100755 scripts/close_pull_requests_with_require_type_hints.sh diff --git a/scripts/close_pull_requests_with_awaiting_changes.sh b/scripts/close_pull_requests_with_awaiting_changes.sh new file mode 100755 index 000000000000..12a7f161c75b --- /dev/null +++ b/scripts/close_pull_requests_with_awaiting_changes.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# List all open pull requests +prs=$(gh pr list --state open --json number,title,labels --limit 200) + +# Loop through each pull request +echo "$prs" | jq -c '.[]' | while read -r pr; do + pr_number=$(echo "$pr" | jq -r '.number') + pr_title=$(echo "$pr" | jq -r '.title') + pr_labels=$(echo "$pr" | jq -r '.labels') + + # Check if the "awaiting changes" label is present + awaiting_changes=$(echo "$pr_labels" | jq -r '.[] | select(.name == "awaiting changes")') + echo "Checking PR #$pr_number $pr_title ($awaiting_changes) ($pr_labels)" + + # If awaiting_changes, close the pull request + if [[ -n "$awaiting_changes" ]]; then + echo "Closing PR #$pr_number $pr_title due to awaiting_changes label" + gh pr close "$pr_number" --comment "Closing awaiting_changes PRs to prepare for Hacktoberfest 2024" + sleep 2 + fi +done diff --git a/scripts/close_pull_requests_with_failing_tests.sh b/scripts/close_pull_requests_with_failing_tests.sh new file mode 100755 index 000000000000..e971f13d452d --- /dev/null +++ b/scripts/close_pull_requests_with_failing_tests.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# List all open pull requests +prs=$(gh pr list --state open --json number,title,labels --limit 200) + +# Loop through each pull request +echo "$prs" | jq -c '.[]' | while read -r pr; do + pr_number=$(echo "$pr" | jq -r '.number') + pr_title=$(echo "$pr" | jq -r '.title') + pr_labels=$(echo "$pr" | jq -r '.labels') + + # Check if the "tests are failing" label is present + tests_are_failing=$(echo "$pr_labels" | jq -r '.[] | select(.name == "tests are failing")') + echo "Checking PR #$pr_number $pr_title ($tests_are_failing) ($pr_labels)" + + # If there are failing tests, close the pull request + if [[ -n "$tests_are_failing" ]]; then + echo "Closing PR #$pr_number $pr_title due to tests_are_failing label" + gh pr close "$pr_number" --comment "Closing tests_are_failing PRs to prepare for Hacktoberfest 2024" + sleep 2 + fi +done diff --git a/scripts/close_pull_requests_with_require_descriptive_names.sh b/scripts/close_pull_requests_with_require_descriptive_names.sh new file mode 100755 index 000000000000..cf163a754ed6 --- /dev/null +++ b/scripts/close_pull_requests_with_require_descriptive_names.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# List all open pull requests +prs=$(gh pr list --state open --json number,title,labels --limit 200) + +# Loop through each pull request +echo "$prs" | jq -c '.[]' | while read -r pr; do + pr_number=$(echo "$pr" | jq -r '.number') + pr_title=$(echo "$pr" | jq -r '.title') + pr_labels=$(echo "$pr" | jq -r '.labels') + + # Check if the "require descriptive names" label is present + require_descriptive_names=$(echo "$pr_labels" | jq -r '.[] | select(.name == "require descriptive names")') + echo "Checking PR #$pr_number $pr_title ($require_descriptive_names) ($pr_labels)" + + # If there are require_descriptive_names, close the pull request + if [[ -n "$require_descriptive_names" ]]; then + echo "Closing PR #$pr_number $pr_title due to require_descriptive_names label" + gh pr close "$pr_number" --comment "Closing require_descriptive_names PRs to prepare for Hacktoberfest 2024" + fi +done diff --git a/scripts/close_pull_requests_with_require_tests.sh b/scripts/close_pull_requests_with_require_tests.sh new file mode 100755 index 000000000000..59069867466d --- /dev/null +++ b/scripts/close_pull_requests_with_require_tests.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# List all open pull requests +prs=$(gh pr list --state open --json number,title,labels --limit 200) + +# Loop through each pull request +echo "$prs" | jq -c '.[]' | while read -r pr; do + pr_number=$(echo "$pr" | jq -r '.number') + pr_title=$(echo "$pr" | jq -r '.title') + pr_labels=$(echo "$pr" | jq -r '.labels') + + # Check if the "require_tests" label is present + require_tests=$(echo "$pr_labels" | jq -r '.[] | select(.name == "require tests")') + echo "Checking PR #$pr_number $pr_title ($require_tests) ($pr_labels)" + + # If there require tests, close the pull request + if [[ -n "$require_tests" ]]; then + echo "Closing PR #$pr_number $pr_title due to require_tests label" + gh pr close "$pr_number" --comment "Closing require_tests PRs to prepare for Hacktoberfest 2024" + # sleep 2 + fi +done diff --git a/scripts/close_pull_requests_with_require_type_hints.sh b/scripts/close_pull_requests_with_require_type_hints.sh new file mode 100755 index 000000000000..0b9ad3d2c0bf --- /dev/null +++ b/scripts/close_pull_requests_with_require_type_hints.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# List all open pull requests +prs=$(gh pr list --state open --json number,title,labels --limit 200) + +# Loop through each pull request +echo "$prs" | jq -c '.[]' | while read -r pr; do + pr_number=$(echo "$pr" | jq -r '.number') + pr_title=$(echo "$pr" | jq -r '.title') + pr_labels=$(echo "$pr" | jq -r '.labels') + + # Check if the "require type hints" label is present + require_type_hints=$(echo "$pr_labels" | jq -r '.[] | select(.name == "require type hints")') + echo "Checking PR #$pr_number $pr_title ($require_type_hints) ($pr_labels)" + + # If require_type_hints, close the pull request + if [[ -n "$require_type_hints" ]]; then + echo "Closing PR #$pr_number $pr_title due to require_type_hints label" + gh pr close "$pr_number" --comment "Closing require_type_hints PRs to prepare for Hacktoberfest 2024" + fi +done From 82163202761e2af135124b45e6ec5ade2cbed5d9 Mon Sep 17 00:00:00 2001 From: Christian Clauss <cclauss@me.com> Date: Mon, 30 Sep 2024 12:24:36 +0200 Subject: [PATCH 2/3] --limit=500 --- scripts/close_pull_requests_with_awaiting_changes.sh | 2 +- scripts/close_pull_requests_with_failing_tests.sh | 2 +- scripts/close_pull_requests_with_require_descriptive_names.sh | 2 +- scripts/close_pull_requests_with_require_tests.sh | 2 +- scripts/close_pull_requests_with_require_type_hints.sh | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/close_pull_requests_with_awaiting_changes.sh b/scripts/close_pull_requests_with_awaiting_changes.sh index 12a7f161c75b..451d649b474d 100755 --- a/scripts/close_pull_requests_with_awaiting_changes.sh +++ b/scripts/close_pull_requests_with_awaiting_changes.sh @@ -1,7 +1,7 @@ #!/bin/bash # List all open pull requests -prs=$(gh pr list --state open --json number,title,labels --limit 200) +prs=$(gh pr list --state open --json number,title,labels --limit 500) # Loop through each pull request echo "$prs" | jq -c '.[]' | while read -r pr; do diff --git a/scripts/close_pull_requests_with_failing_tests.sh b/scripts/close_pull_requests_with_failing_tests.sh index e971f13d452d..6d72a57a134f 100755 --- a/scripts/close_pull_requests_with_failing_tests.sh +++ b/scripts/close_pull_requests_with_failing_tests.sh @@ -1,7 +1,7 @@ #!/bin/bash # List all open pull requests -prs=$(gh pr list --state open --json number,title,labels --limit 200) +prs=$(gh pr list --state open --json number,title,labels --limit 500) # Loop through each pull request echo "$prs" | jq -c '.[]' | while read -r pr; do diff --git a/scripts/close_pull_requests_with_require_descriptive_names.sh b/scripts/close_pull_requests_with_require_descriptive_names.sh index cf163a754ed6..f38e481f539c 100755 --- a/scripts/close_pull_requests_with_require_descriptive_names.sh +++ b/scripts/close_pull_requests_with_require_descriptive_names.sh @@ -1,7 +1,7 @@ #!/bin/bash # List all open pull requests -prs=$(gh pr list --state open --json number,title,labels --limit 200) +prs=$(gh pr list --state open --json number,title,labels --limit 500) # Loop through each pull request echo "$prs" | jq -c '.[]' | while read -r pr; do diff --git a/scripts/close_pull_requests_with_require_tests.sh b/scripts/close_pull_requests_with_require_tests.sh index 59069867466d..45bce62427e7 100755 --- a/scripts/close_pull_requests_with_require_tests.sh +++ b/scripts/close_pull_requests_with_require_tests.sh @@ -1,7 +1,7 @@ #!/bin/bash # List all open pull requests -prs=$(gh pr list --state open --json number,title,labels --limit 200) +prs=$(gh pr list --state open --json number,title,labels --limit 500) # Loop through each pull request echo "$prs" | jq -c '.[]' | while read -r pr; do diff --git a/scripts/close_pull_requests_with_require_type_hints.sh b/scripts/close_pull_requests_with_require_type_hints.sh index 0b9ad3d2c0bf..cf47bcff8966 100755 --- a/scripts/close_pull_requests_with_require_type_hints.sh +++ b/scripts/close_pull_requests_with_require_type_hints.sh @@ -1,7 +1,7 @@ #!/bin/bash # List all open pull requests -prs=$(gh pr list --state open --json number,title,labels --limit 200) +prs=$(gh pr list --state open --json number,title,labels --limit 500) # Loop through each pull request echo "$prs" | jq -c '.[]' | while read -r pr; do From ce7fe2f7ea8ff61431fc6de4935513bd951bb77c Mon Sep 17 00:00:00 2001 From: Christian Clauss <cclauss@me.com> Date: Mon, 30 Sep 2024 12:42:34 +0200 Subject: [PATCH 3/3] Lose 2024 --- scripts/close_pull_requests_with_awaiting_changes.sh | 2 +- scripts/close_pull_requests_with_failing_tests.sh | 2 +- scripts/close_pull_requests_with_require_descriptive_names.sh | 2 +- scripts/close_pull_requests_with_require_tests.sh | 2 +- scripts/close_pull_requests_with_require_type_hints.sh | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/close_pull_requests_with_awaiting_changes.sh b/scripts/close_pull_requests_with_awaiting_changes.sh index 451d649b474d..55e19c980596 100755 --- a/scripts/close_pull_requests_with_awaiting_changes.sh +++ b/scripts/close_pull_requests_with_awaiting_changes.sh @@ -16,7 +16,7 @@ echo "$prs" | jq -c '.[]' | while read -r pr; do # If awaiting_changes, close the pull request if [[ -n "$awaiting_changes" ]]; then echo "Closing PR #$pr_number $pr_title due to awaiting_changes label" - gh pr close "$pr_number" --comment "Closing awaiting_changes PRs to prepare for Hacktoberfest 2024" + gh pr close "$pr_number" --comment "Closing awaiting_changes PRs to prepare for Hacktoberfest" sleep 2 fi done diff --git a/scripts/close_pull_requests_with_failing_tests.sh b/scripts/close_pull_requests_with_failing_tests.sh index 6d72a57a134f..3ec5960aed27 100755 --- a/scripts/close_pull_requests_with_failing_tests.sh +++ b/scripts/close_pull_requests_with_failing_tests.sh @@ -16,7 +16,7 @@ echo "$prs" | jq -c '.[]' | while read -r pr; do # If there are failing tests, close the pull request if [[ -n "$tests_are_failing" ]]; then echo "Closing PR #$pr_number $pr_title due to tests_are_failing label" - gh pr close "$pr_number" --comment "Closing tests_are_failing PRs to prepare for Hacktoberfest 2024" + gh pr close "$pr_number" --comment "Closing tests_are_failing PRs to prepare for Hacktoberfest" sleep 2 fi done diff --git a/scripts/close_pull_requests_with_require_descriptive_names.sh b/scripts/close_pull_requests_with_require_descriptive_names.sh index f38e481f539c..0fc3cec1d247 100755 --- a/scripts/close_pull_requests_with_require_descriptive_names.sh +++ b/scripts/close_pull_requests_with_require_descriptive_names.sh @@ -16,6 +16,6 @@ echo "$prs" | jq -c '.[]' | while read -r pr; do # If there are require_descriptive_names, close the pull request if [[ -n "$require_descriptive_names" ]]; then echo "Closing PR #$pr_number $pr_title due to require_descriptive_names label" - gh pr close "$pr_number" --comment "Closing require_descriptive_names PRs to prepare for Hacktoberfest 2024" + gh pr close "$pr_number" --comment "Closing require_descriptive_names PRs to prepare for Hacktoberfest" fi done diff --git a/scripts/close_pull_requests_with_require_tests.sh b/scripts/close_pull_requests_with_require_tests.sh index 45bce62427e7..89a54996b584 100755 --- a/scripts/close_pull_requests_with_require_tests.sh +++ b/scripts/close_pull_requests_with_require_tests.sh @@ -16,7 +16,7 @@ echo "$prs" | jq -c '.[]' | while read -r pr; do # If there require tests, close the pull request if [[ -n "$require_tests" ]]; then echo "Closing PR #$pr_number $pr_title due to require_tests label" - gh pr close "$pr_number" --comment "Closing require_tests PRs to prepare for Hacktoberfest 2024" + gh pr close "$pr_number" --comment "Closing require_tests PRs to prepare for Hacktoberfest" # sleep 2 fi done diff --git a/scripts/close_pull_requests_with_require_type_hints.sh b/scripts/close_pull_requests_with_require_type_hints.sh index cf47bcff8966..df5d88289cf0 100755 --- a/scripts/close_pull_requests_with_require_type_hints.sh +++ b/scripts/close_pull_requests_with_require_type_hints.sh @@ -16,6 +16,6 @@ echo "$prs" | jq -c '.[]' | while read -r pr; do # If require_type_hints, close the pull request if [[ -n "$require_type_hints" ]]; then echo "Closing PR #$pr_number $pr_title due to require_type_hints label" - gh pr close "$pr_number" --comment "Closing require_type_hints PRs to prepare for Hacktoberfest 2024" + gh pr close "$pr_number" --comment "Closing require_type_hints PRs to prepare for Hacktoberfest" fi done