-
-
Notifications
You must be signed in to change notification settings - Fork 46.8k
Scripts for closing pull requests for Hacktoberfest #11587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
cclauss
merged 3 commits into
TheAlgorithms:master
from
cclauss:scripts_for_closing_pull_requests
Sep 30, 2024
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 "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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 2024" | ||
sleep 2 | ||
fi | ||
done |
21 changes: 21 additions & 0 deletions
21
scripts/close_pull_requests_with_require_descriptive_names.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/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 "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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 "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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/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 "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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.