Skip to content

chore: add stale branch cleanup tool and test suite - #36561

Draft
torreypayne wants to merge 1 commit into
mainfrom
chore/delete-stale-branches-script
Draft

torreypayne wants to merge 1 commit into
mainfrom
chore/delete-stale-branches-script

Conversation

@torreypayne

@torreypayne torreypayne commented Sep 11, 2026

Copy link
Copy Markdown
Member

Summary

Addresses Buganizer issue b/558882844: "Clean up stale branches in google-cloud-ruby".

The google-cloud-ruby repository currently has 2,402 remote branches. Below is the audit summary of the identified stale branches proposed for deletion, along with the safety criteria used to preserve all active and in-flight work.

cc @aandreassa for visibility and confirmation before we execute the branch deletions.


Branch Evaluation & Count Summary

Category Count Status / Action Description
Protected Base Branches 2 PRESERVE main, gh-pages
Active Open PR Heads 7 PRESERVE Branches backing active open pull requests on the repo
Recent Activity (<30 days) 6 PRESERVE Branches with commits in the last 30 days
Legacy Bot Branches 2,259 DELETE owl-bot-* and autosynth-* branches from 2020–2022
Merged PR Branches 13 DELETE Branches whose associated PR was already merged into main
Closed PR Branches 88 DELETE Branches whose PR was closed without merge (>30 days old)
Abandoned No-PR Branches 26 DELETE Old experimental branches with no PR opened (>30 days old)
Total Evaluated 2,402 Total Proposed to Delete: 2,386 (99.3% bot)

1. Protected / Preserved Branches (16 Total — Zero Risk to Active Work)

These branches will NOT be touched:

Base & Docsite (2)

  • main (Default branch)
  • gh-pages (Documentation site)

Active Open PR Heads (7)

Recent Activity within 30-Day Grace Period (6)

  • chore/zizmor-fixes (Last commit: 2026-08-21)
  • ci/demo-doctests-execution (Last commit: 2026-08-24)
  • owl-bot-copy-google-cloud-compute-v1 (Last commit: 2026-09-02)
  • owl-bot-copy-google-cloud-storage-control-v2 (Last commit: 2026-08-20)
  • release-please--branches--main--components--google-apps-chat-v1 (Last commit: 2026-08-18)
  • tombstone-apigee-registry-v1 (Last commit: 2026-08-12)

2. Identified Branches to Delete (2,386 Total)

A. Legacy Bot Branches (2,259 Branches)

Ephemeral branches generated by automated bots between 2020 and 2022 that were left behind:

  • owl-bot-*: 2,249 branches
  • autosynth-*: 10 branches (autosynth-asset-v1beta1, autosynth-datastore, autosynth-debugger, autosynth-error_reporting, autosynth-firestore, autosynth-irm, autosynth-logging, autosynth-pubsub, autosynth-trace, autosynth-webrisk)

B. Merged PR Branches (13 Branches)

Branches whose work was already merged into main:

Branch Name PR # Last Commit Date Commit Headline
context-aware-commits #5085 2020-03-19 chore: enable context-aware commits for one API
czahedi-patch-1 #5916 2020-05-06 Update CODEOWNERS
docpub #11049 2021-03-30 fix version setting
release-google-cloud-asset-v1-v0.6.0 #7607 2020-09-03 chore: updated google-cloud-asset-v1/lib/google/clo
release-google-cloud-dialogflow-v2-v0.6.5 #7247 2020-08-06 chore: updated google-cloud-dialogflow-v2/lib/googl
release-google-cloud-memcache-v1beta2-v0.1.3 #7394 2020-08-10 chore: updated google-cloud-memcache-v1beta2/lib/go
release-please--branches--main--components--google-cloud-scheduler #24373 2026-08-05 chore(main): release google-cloud-scheduler 3.2.1
release-please--branches--main--components--grafeas #24410 2026-08-05 chore(main): release grafeas 1.8.1
samples-presubmit-master #5397 2020-04-09 expand presubmit check in windows build
shivng-storage-samples #19467 2022-11-24 Merge branch 'main' into shivng-storage-samples
srs #11208 2021-04-23 chore: add sync repo settings config
system-tests-against-emulator #6909 2020-06-25 Update the shell script.
zizmor-cleanup #34682 2026-07-01 chore(actions): address zizmor security and contain

C. Abandoned No-PR Branches (26 Branches)

Stale ad-hoc branches with no associated pull requests (last updated 2016–2026):

Branch Name Last Commit Date Commit Headline
automl-samples 2020-05-27 asdf
bcb-to-fb 2021-01-28 test(datastore): Improve isolation of samples test
buildozer-games 2020-08-11 DO NOT MERGE: scripts to process synth.py files int
chore/automate-gemfile-locks-phase-2 2026-07-08 chore(deps): enroll Batch 2 generated gems (A-D) in
chore/owlbot-lockfile-automation 2026-07-23 feat: automate lockfile generation in OwlBot and re
chore/renovate-daily-pilot-expansion 2026-07-14 chore(deps): unignore Gemfile.lock in 4 daily pilot
chore/seed-lockfiles-1785437666 2026-07-30 chore(script): drop multithreading and add .gitigno
compose-delete-source 2026-06-24 feat(storage): support deleteSourceObjects option i
demo-generate-asset-v1 2026-07-24 feat: generate google-cloud-asset-v1
dev/virost/chore/github_creds 2026-01-12 chore: keep debug step commented out
df-samples 2020-03-19 asdf
er-fix-project 2026-05-13 fix(error_reporting): Honor quota_project configura
gcloud-jsondoc 2017-09-26 Update Generator#write_to
gcloud-rdoc 2016-11-19 Add circle.yml file to ignore branch on builds
google-cloud-asset-synth.metadata-test 2020-07-29 no changes
google-cloud-pubsub-v1-stable 2025-07-09 chore(secret_manager): Added SecretManager Tags Sam
lifecycle-action-multipart-upload-extend 2022-06-28 Add matches prefix/suffix rule to new lifecycle act
pubsub-docs 2021-09-22 docs(pubsub): correct spelling
pubsub-exactly-once-delivery-support 2022-05-18 feat: Initial generation of google-cloud-bigquery-d
rad 2020-10-26 asdf
ruby-2.3-compatible 2019-10-07 chore(container_analysis): Ensure container-analysi
stateless 2026-03-13 feat(bigquery): Stateless Queries
test-b 2025-09-09 empty
test-run-gapic-gitignore-lockfile-blockchainnodeengine 2026-07-28 feat(blockchainnodeengine-v1): track native Gemfile
test-run-gapic-gitignore-lockfile-modelarmor 2026-07-28 feat(modelarmor-v1): track native Gemfile.lock from
yard-gcloud 2016-11-19 Add circle.yml file to ignore branch on builds

D. Closed / Unmerged PR Branches (88 Branches)

Click to expand full list of 88 closed PR branches
Branch Name PR # Last Commit Date Commit Headline
add-delete-folder-recursive-sample #34034 2026-06-10 samples(storagecontrol): add delete folder recursiv
admin-latest #30529 2025-06-18 Add missing subscriber method
ads-manager-paths #27486 2024-10-24 feat: Initial generation of google-ads-ad_manager-v
bigquery-ci-test #34024 2026-07-13 chore: test CI presubmits
bq-5mb-json-test #31568 2025-10-01 chore: Add integration test for JSON uploads over 5
chat-library-gen #25440 2024-03-26 rubocop fix to .owlbot.rb
chore/add-lockfile-seeder #35041 2026-07-30 chore: strictly bind root Gemfile.lock ignore to ro
chore/phase2-expansion-round-2 #34976 2026-07-20 chore(deps): generate lockfiles and enroll 10 clien
chore/renovate-schedule-grouping #35106 2026-08-04 chore(renovate): restrict update schedule to weeken
chore/renovate-wildcard-enrolled-lockfiles #34988 2026-07-21 chore(deps): align Renovate config with gapic-gener
compose-delete-source-objects-ruby #34662 2026-06-23 feat(storage): support delete_source_objects in com
compute-accept-fix #34623 2026-06-18 test(compute-v1): Address flaky tests
dataplex-v1-fix #33976 2026-05-22 chore(google-cloud-dataplex-v1): Skip generator of
demo-gen-fix-07-2026 #34726 2026-07-08 chore: Demo generator fix
demo-generator #35083 2026-07-31 chore: Demo for google protobuf updates to ~> 33.2
feat-ruby-delete-folder-recursive #34605 2026-06-11 feat(ruby): add deleteFolderRecursive sample
firestore-headers-issue #23532 2023-11-09 Comment print statements
firestore-replace-legacy-header #24490 2024-01-29 Fix a failing test
fix_chrome_session #25306 2024-03-14 chore: remove other options
fix_storage_labels #19213 2022-09-26 Added the time delay
g-husam-patch-1 #34678 2026-07-09 chore(renovate): merge main updates into json5 conf
google-cloud-dataplex-v1-fix #33820 2026-04-09 fix(dataplex)!: remove deprecated Explore-related m
mb.synthtool_import #4411 2019-11-13 Imported synthtool
obsolete-resource-settings #29311 2025-03-07 chore: obsolete google-cloud-resource_settings-v1 a
pin-conformance-tests #34724 2026-07-07 chore: pin GH Actions by SHA in conformance workflo
polling-harness-bigtable #26132 2024-06-18 chore: Utilize polling harness in Bigtable replicat
pubsub_dev #13303 2021-08-10 Revert before merge: Use staging endpoint
release-gcloud-v0.25.0 #7904 2020-10-09 Release gcloud 0.25.0
release-google-analytics-admin-v1alpha-v0.5.1 #9912 2021-03-01 chore: release google-analytics-admin-v1alpha 0.5.1
release-google-cloud-access_approval-v0.4.0 #7870 2020-10-16 Release google-cloud-access_approval 0.4.0
release-google-cloud-asset-v0.7.1 #4909 2020-03-10 updated google-cloud-asset/lib/google/cloud/asset/v
release-google-cloud-asset-v1beta1-v0.3.0 #7881 2020-10-16 Release google-cloud-asset-v1beta1 0.3.0
release-google-cloud-asset-v2.0.0 #7876 2020-10-16 Release google-cloud-asset 2.0.0
release-google-cloud-automl-v0.4.1 #4446 2019-11-25 updated google-cloud-automl/lib/google/cloud/automl
release-google-cloud-bigquery-v1.23.1 #8046 2020-10-28 Release google-cloud-bigquery 1.23.1
release-google-cloud-bigtable-v0.8.1 #4405 2019-12-03 updated google-cloud-bigtable/lib/google/cloud/bigt
release-google-cloud-bigtable-v2.3.1 #10832 2021-03-09 chore: release google-cloud-bigtable 2.3.1
release-google-cloud-bigtable-v3.0.0 #7937 2020-10-16 Release google-cloud-bigtable 3.0.0
release-google-cloud-container-v2.0.0 #7879 2020-10-16 Release google-cloud-container 2.0.0
release-google-cloud-container_analysis-v2.0.0 #7882 2020-10-16 Release google-cloud-container_analysis 2.0.0
release-google-cloud-dataproc-v2.0.0 #7899 2020-10-16 Release google-cloud-dataproc 2.0.0
release-google-cloud-debugger-v0.37.0 #7057 2020-07-21 updated google-cloud-debugger/lib/google/cloud/debu
release-google-cloud-dialogflow-v2.0.0 #7889 2020-10-16 Release google-cloud-dialogflow 2.0.0
release-google-cloud-env-v1.5.0 #7987 2020-10-16 Release google-cloud-env 1.5.0
release-google-cloud-error_reporting-v0.36.0 #7056 2020-07-21 updated google-cloud-error_reporting/lib/google/clo
release-google-cloud-language-v2.0.0 #7909 2020-10-16 Release google-cloud-language 2.0.0
release-google-cloud-memcache-v0.2.0 #9621 2021-02-24 chore: release google-cloud-memcache 0.2.0
release-google-cloud-monitoring-v0.37.3 #5560 2020-04-20 updated google-cloud-monitoring/lib/google/cloud/mo
release-google-cloud-monitoring-v0.39.0 #6296 2020-06-01 updated google-cloud-monitoring/lib/google/cloud/mo
release-google-cloud-os_login-v2.0.0 #7886 2020-10-16 Release google-cloud-os_login 2.0.0
release-google-cloud-pubsub-v1.3.2 #4912 2020-03-09 updated google-cloud-pubsub/lib/google/cloud/pubsub
release-google-cloud-redis-v2.0.0 #7896 2020-10-16 Release google-cloud-redis 2.0.0
release-google-cloud-secret_manager-v0.1.1 #4695 2020-01-17 updated google-cloud-secret_manager/lib/google/clou
release-google-cloud-security_center-v2.0.0 #7913 2020-10-16 Release google-cloud-security_center 2.0.0
release-google-cloud-service_directory-v0.4.0 #7911 2020-12-07 chore: release google-cloud-service_directory 0.4.0
release-google-cloud-spanner-v2.1.1 #7610 2020-09-04 chore: updated google-cloud-spanner/lib/google/clou
release-google-cloud-spanner-v3.0.0 #7933 2020-10-16 Release google-cloud-spanner 3.0.0
release-google-cloud-speech-v0.42.0 #5140 2020-05-05 updated google-cloud-speech/lib/google/cloud/speech
release-google-cloud-speech-v2.0.0 #7928 2020-10-16 Release google-cloud-speech 2.0.0
release-google-cloud-storage-v1.23.1 #4386 2019-11-12 updated google-cloud-storage/lib/google/cloud/stora
release-google-cloud-storage-v1.24.1 #4440 2019-12-12 updated google-cloud-storage/lib/google/cloud/stora
release-google-cloud-storage-v1.26.3 #6993 2020-07-28 chore: updated google-cloud-storage/lib/google/clou
release-google-cloud-storage-v1.28.1 #7622 2020-09-15 Release google-cloud-storage 1.28.1
release-google-cloud-storage-v1.29.3 #8411 2021-01-08 chore: release google-cloud-storage 1.29.3
release-google-cloud-storage-v2.0.0 #7127 2020-08-26 chore: updated google-cloud-storage/lib/google/clou
release-google-cloud-talent-v0.21.0 #7925 2020-10-16 Release google-cloud-talent 0.21.0
release-google-cloud-talent-v2.0.0 #8041 2020-10-16 Release google-cloud-talent 2.0.0
release-google-cloud-trace-v0.36.2 #4447 2019-12-05 updated google-cloud-trace/lib/google/cloud/trace/v
release-google-cloud-translate-v4.0.0 #8018 2020-10-16 Release google-cloud-translate 4.0.0
release-google-cloud-video_intelligence-v2.0.4 #4919 2020-03-10 updated google-cloud-video_intelligence/lib/google/
release-google-cloud-video_intelligence-v4.0.0 #7934 2020-10-16 Release google-cloud-video_intelligence 4.0.0
release-google-cloud-vision-v0.39.0 #5144 2020-06-01 updated google-cloud-vision/lib/google/cloud/vision
release-google-cloud-vision-v2.0.0 #7927 2020-10-16 Release google-cloud-vision 2.0.0
release-google-cloud-webrisk-v0.7.0 #7924 2020-10-16 Release google-cloud-webrisk 0.7.0
release-please--branches--main--components--google-cloud-merchant-issue_resolution-v1beta #30423 2025-05-22 🦉 Updates from OwlBot post-processor
release-stackdriver-v0.17.0 #8178 2020-12-02 chore: release stackdriver 0.17.0
remove-dupe-samples #8584 2021-01-07 Removing samples that are in ruby-docs-samples
renovate/core-handwritten-gems-lockfiles #34767 2026-07-14 chore(deps): update core handwritten gems lockfiles
renovate/major-core-handwritten-gems-lockfiles #34768 2026-07-14 chore(deps): update core handwritten gems lockfiles
sg-google-chat-v1 #25337 2024-03-07 feat: Initial release of generated goog-apps-chat-v
test-ci #34751 2026-07-15 chore: test
test-generator-updates #34013 2026-06-04 chore: Showcase of generator updates
test-protobuf-36 #34788 2026-07-14 chore: Test upgrade to Protocol Buffers v36.0-rc1
test-pubsub-all #30580 2025-06-27 Merge remote-tracking branch 'origin/main' into pub
test-run-gapic-gitignore-lockfile #35030 2026-07-28 feat(language-v2): track native Gemfile.lock from g
test-run-gapic-minitest-reporters-language-v2 #35032 2026-07-29 feat(language-v2): regenerate language-v2 with reno
test-run-speech-v1 #35036 2026-07-29 chore(speech-v1): test regenerate gapic client to v
viacheslav-rostovtsev-patch-1 #30593 2025-07-01 Update aggregate_query_test.rb

Confirmation & Next Steps

  • Once @aandreassa confirms this list, we will proceed with deleting the identified branches.

Add script/delete-stale-branches.rb to identify and safely delete stale remote branches across googleapis/google-cloud-ruby.

Key features and safety protections:
- Unconditionally protects base branches (main, master, gh-pages)
- Dynamically discovers and protects all active open PR heads
- Protects branches with commits within the grace period (default: 30 days)
- Dry-run mode by default to prevent accidental deletions
- Supports batched deletion via git push origin --delete or GitHub API
- Includes automated unit test suite in script/test_delete_stale_branches.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant