From 773dd60683c3cdfcb750047c947e49e9e9ffefe8 Mon Sep 17 00:00:00 2001 From: Nubenetes Bot Date: Fri, 15 May 2026 14:08:12 +0200 Subject: [PATCH] feat: add bi-weekly automated branch cleanup workflow and documentation --- .github/workflows/cleanup_merged_branches.yml | 39 +++++++++++++++++++ GEMINI.md | 1 + README.md | 4 ++ 3 files changed, 44 insertions(+) create mode 100644 .github/workflows/cleanup_merged_branches.yml diff --git a/.github/workflows/cleanup_merged_branches.yml b/.github/workflows/cleanup_merged_branches.yml new file mode 100644 index 00000000..472a629b --- /dev/null +++ b/.github/workflows/cleanup_merged_branches.yml @@ -0,0 +1,39 @@ +name: Automated Merged Branch Cleanup + +on: + schedule: + # Runs at 00:00 on day 1 and 15 of every month + - cron: '0 0 1,15 * *' + workflow_dispatch: # Allow manual trigger for testing + +jobs: + cleanup: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Delete merged branches + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + + echo "Fetching latest changes..." + git fetch --prune + + echo "Identifying branches merged into develop..." + # Get remote branches merged into origin/develop + # Filter out protected branches: master, develop, gh-pages, and the HEAD pointer + branches=$(git branch -r --merged origin/develop | grep -vE 'origin/(master|develop|gh-pages|HEAD)' | sed 's/.*origin\///') + + if [ -z "$branches" ]; then + echo "No merged branches to clean up." + exit 0 + fi + + for branch in $branches; do + echo "Deleting remote branch: $branch" + git push origin --delete "$branch" + done diff --git a/GEMINI.md b/GEMINI.md index bda8848a..e26bba83 100644 --- a/GEMINI.md +++ b/GEMINI.md @@ -20,6 +20,7 @@ This file contains the accumulated instructions and long-term vision for the aut 14. **Persistent V2 Caching**: The V2 Optimizer MUST use a persistent cache file (`data/v2_cache.json`) to store AI evaluations (year, quality, category). This is mandatory to minimize API costs and ensure execution speed across 15k+ links. 15. **GitHub Metadata Enrichment**: For all `github.com` resources, the bot MUST attempt to fetch real-time metadata (stars, last commit) using the GitHub API. This data must be included in the V2 rendering to provide current context. 16. **Resilient Link Health**: Every V2 generation cycle MUST perform asynchronous health checks. The bot MUST use identity rotation (User-Agents) and multiple attempts (3x) with backoff to minimize false negatives. Only definitive **404 Not Found** errors lead to removal; other failures (timeouts, 403s) result in the link being preserved but flagged as `[OFFLINE?]` to ensure maximum technical preservation. GitHub and 'Foundational' resources are exempt from removal based on health checks. +17. **Automated Branch Hygiene**: To keep the repository clean and efficient, an automated cleanup MUST run every 15 days (1st and 15th) to delete remote branches already merged into `develop`. The branches `master`, `develop`, and `gh-pages` are strictly protected and MUST NEVER be deleted. ## 🛠️ Structural Evolution & Navigation ... diff --git a/README.md b/README.md index 6944acce..10e372e7 100644 --- a/README.md +++ b/README.md @@ -238,6 +238,7 @@ Nubenetes uses a sophisticated multi-stage automation pipeline. Below is the det | 4 | **[Link Health Check](https://github.com/nubenetes/awesome-kubernetes/actions/workflows/intelligent_link_cleaner.yml)** | [`intelligent_link_cleaner.yml`](.github/workflows/intelligent_link_cleaner.yml) | **Maintenance:** Global asynchronous health check, deduplication, and `[OFFLINE?]` flagging. | Monthly / Manual | `develop` | | 5 | **[Backup Curation](https://github.com/nubenetes/awesome-kubernetes/actions/workflows/agentic_backup.yml)** | [`agentic_backup.yml`](.github/workflows/agentic_backup.yml) | **Historical Ingestion:** Processes manual JSON/MD backups through the Agentic AI pipeline. | Manual | `develop` | | 6 | **[Production Deploy](https://github.com/nubenetes/awesome-kubernetes/actions/workflows/main.yml)** | [`main.yml`](.github/workflows/main.yml) | **Deployment:** Builds both V1 and V2 editions using MkDocs and deploys to nubenetes.com. | Push to `master` | GitHub Pages | +| 7 | **[Merged Branch Cleanup](https://github.com/nubenetes/awesome-kubernetes/actions/workflows/cleanup_merged_branches.yml)** | [`cleanup_merged_branches.yml`](.github/workflows/cleanup_merged_branches.yml) | **Hygiene:** Automatically deletes remote branches merged into `develop` to keep the repo clean. | Bi-weekly (1st/15th) | `develop` | ### Recommended Execution Pipeline @@ -305,6 +306,9 @@ Nubenetes follows a dual-branch GitOps model to ensure stability while allowing - The stable, production-ready branch that powers [nubenetes.com](https://nubenetes.com). - **Direct PRs to `master` are strictly prohibited.** - Only the repository owner performs the final review and merge from `develop` to `master`. +- **Branch Lifecycle Automation:** + - To maintain repository hygiene, an automated workflow deletes remote branches merged into `develop` every 15 days (1st and 15th of each month). + - **Protected Branches:** The branches `master`, `develop`, and `gh-pages` are EXEMPT from deletion and will always be preserved. ---