mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 01:09:40 +08:00
Scripts for closing pull requests for Hacktoberfest (#11587)
* Scripts for closing pull requests for Hacktoberfest * --limit=500 * Lose 2024
This commit is contained in:
22
scripts/close_pull_requests_with_failing_tests.sh
Executable file
22
scripts/close_pull_requests_with_failing_tests.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
# List all open pull requests
|
||||
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
|
||||
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"
|
||||
sleep 2
|
||||
fi
|
||||
done
|
Reference in New Issue
Block a user