-
Notifications
You must be signed in to change notification settings - Fork 808
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tools: Update list-repo-maintenance-commits
* Collect the stub updates separately, don't include them in the Renovate list. * Ignore `.phan/stubs/` and `tools/stubs/*-defs.php` when looking for PRs touching stuff outside of projects. Probably it's not really maintenance, just someone needing a new stub. * Allow for passing a date range into the script.
- Loading branch information
Showing
1 changed file
with
41 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -7,17 +7,19 @@ source tools/includes/chalk-lite.sh | |
source tools/includes/check-osx-bash-version.sh | ||
|
||
# Email addresses of people who often author maintenance PRs. | ||
# Note the renovate bot is handled separately. | ||
# Note Matticbot is handled separately. | ||
AUTHORS=( | ||
[email protected] | ||
[email protected] | ||
) | ||
|
||
# Paths outside of projects/ to ignore. | ||
PATHS=( | ||
':!.phan/stubs/*' | ||
:!pnpm-lock.yaml | ||
:!tools/phpcs-excludelist.json | ||
:!tools/eslint-excludelist.json | ||
':!tools/stubs/*-defs.php' | ||
':!*/composer.lock' | ||
':!*/changelog/*' | ||
':!*/CHANGELOG.md' | ||
|
@@ -91,23 +93,37 @@ function seen { | |
} | ||
|
||
# Figure out which dates to check. | ||
read -r DS DE < <(php -r ' | ||
$t = new DateTimeImmutable( "00:00:00 UTC" ); | ||
$d = $t->format( "N" ) - 1; | ||
printf( | ||
"%s %s\n", | ||
$t->modify( - ( $d + 7 ) . " days" )->format( "Y-m-d" ), | ||
$t->modify( -$d . " days" )->format( "Y-m-d" ) | ||
); | ||
') | ||
if [[ $1 =~ ^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$ ]]; then | ||
DS=$1 | ||
if [[ $2 =~ ^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$ ]]; then | ||
DE=$2 | ||
else | ||
DE=$(date +%F) | ||
fi | ||
else | ||
read -r DS DE < <(php -r ' | ||
$t = new DateTimeImmutable( "00:00:00 UTC" ); | ||
$d = $t->format( "N" ) - 1; | ||
printf( | ||
"%s %s\n", | ||
$t->modify( - ( $d + 7 ) . " days" )->format( "Y-m-d" ), | ||
$t->modify( -$d . " days" )->format( "Y-m-d" ) | ||
); | ||
') | ||
fi | ||
echo '' | ||
info "Listing commits from $DS to <$DE" | ||
|
||
# Collect renovate entries for special reporting, and record the lines that would otherwise be printed as "seen" so they don't get printed in other sections. | ||
# Collect stubs and renovate entries for special reporting, and record the lines that would otherwise be printed as "seen" so they don't get printed in other sections. | ||
STUBS=() | ||
RENOVATE=() | ||
while IFS= read -r LINE; do | ||
SEEN["$(fmt <<<"$LINE")"]=1 | ||
RENOVATE+=( "$(sed -E -e 's/^Update (dependency )?//' -e 's/ to .* (\(#[0-9]+\))$/ \1/' <<<"$LINE" | fmt | sed -e 's!^\* !!')" ) | ||
if [[ "$LINE" == 'phan: Update '*' stubs'* ]]; then | ||
STUBS+=( "$(sed -E -e 's/^phan: Update (.*) stubs/\1/' <<<"$LINE" | fmt | sed -e 's!^\* !!')" ) | ||
else | ||
RENOVATE+=( "$(sed -E -e 's/^Update (dependency )?//' -e 's/ to .* (\(#[0-9]+\))$/ \1/' <<<"$LINE" | fmt | sed -e 's!^\* !!')" ) | ||
fi | ||
done < <( git log --format='%s' --since "$DS 00:00:00 UTC" --until "$DE 00:00:00 UTC" --author='[email protected]' ) | ||
|
||
echo "" | ||
|
@@ -125,10 +141,20 @@ for AUTHOR in "${AUTHORS[@]}"; do | |
seen < <( git log --format='%s' --since "$DS 00:00:00 UTC" --until "$DE 00:00:00 UTC" --author="$AUTHOR" | fmt ) | ||
done | ||
|
||
# Print the renovate line at the end, if applicable. | ||
if [[ ${#RENOVATE} -gt 0 ]]; then | ||
# Print the stubs and renovate lines at the end, if applicable. | ||
if [[ ${#STUBS} -gt 0 || ${#RENOVATE} -gt 0 ]]; then | ||
echo "" | ||
info "Renovate:" | ||
info "Automated:" | ||
fi | ||
if [[ ${#STUBS} -gt 0 ]]; then | ||
P='* Stubs: ' | ||
for R in "${STUBS[@]}"; do | ||
printf '%s' "$P$R" | ||
P=', ' | ||
done | ||
echo "" | ||
fi | ||
if [[ ${#RENOVATE} -gt 0 ]]; then | ||
P='* Renovate: ' | ||
for R in "${RENOVATE[@]}"; do | ||
printf '%s' "$P$R" | ||
|