From 7326f7d9e35ef80e0f6356b854eef7cd0218a308 Mon Sep 17 00:00:00 2001 From: Nubenetes Bot Date: Thu, 21 May 2026 22:48:20 +0200 Subject: [PATCH] feat: add emergency V2 PR generator (read-only recovery) Provides a safe, low-cost way to publish the current cached state of the V2 portal without running the full AI pipeline. Guaranteed read-only cache access. --- .github/workflows/agentic_v2_pr_only.yml | 91 ++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 .github/workflows/agentic_v2_pr_only.yml diff --git a/.github/workflows/agentic_v2_pr_only.yml b/.github/workflows/agentic_v2_pr_only.yml new file mode 100644 index 00000000..6e6ef460 --- /dev/null +++ b/.github/workflows/agentic_v2_pr_only.yml @@ -0,0 +1,91 @@ +name: Emergency V2 PR Generator (Read-Only Recovery) + +on: + workflow_dispatch: + +permissions: + contents: write + pull-requests: write + +concurrency: + group: v2-emergency-${{ github.ref }} + cancel-in-progress: false + +jobs: + recover-and-pr: + runs-on: ubuntu-latest + steps: + - name: Repository Synchronization + uses: actions/checkout@v6 + with: + ref: develop + fetch-depth: 0 + + - name: Python 3.11 Environment Provisioning + uses: actions/setup-python@v6 + with: + python-version: '3.11' + cache: 'pip' + + - name: Restore Incremental Inventory Cache (Mandate 22) + uses: actions/cache/restore@v4 + id: inventory-cache-restore + with: + path: data/inventory.yaml + key: inventory-v2-${{ github.run_id }}-${{ github.run_attempt }} + restore-keys: | + inventory-v2- + + - name: Installation of Dependencies + run: | + python -m pip install --upgrade pip + pip install --no-cache-dir pydantic PyGithub httpx fake-useragent pytz python-dotenv pyyaml tenacity + + - name: Assemble V2 Portal (Render Only) + env: + GEMINI_API_KEY_1: ${{ secrets.GEMINI_API_KEY_1 }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PYTHONPATH: . + PYTHONUNBUFFERED: "1" + run: | + # The --render-only flag short-circuits AI logic and uses the cached inventory. + python src/v2_optimizer.py --render-only + + if [ -f v2_safety_report.md ]; then + cat v2_safety_report.md >> pr_description.md + else + echo "No safety report generated." > pr_description.md + fi + + - name: Consolidate README Metrics (Integrated) + env: + PYTHONPATH: . + run: | + python src/readme_updater.py + python src/safety_readme.py + + - name: Safety Reset for Workflow Files (Security) + run: | + # Ensure no self-modification happens to avoid permission rejections + git checkout HEAD -- .github/workflows/ + + - name: Create Pull Request for V2 Elite Update + id: cpr + uses: peter-evans/create-pull-request@v8 + with: + branch: bot/v2-elite-sync-emergency + base: develop + title: "V2 Elite: Agentic Optimization Sync (Emergency Recovery)" + body-path: pr_description.md + commit-message: "feat: sync V2 elite curated edition from partial cache [skip ci]" + labels: "v2-elite, agentic-sync" + + - name: Post Supplementary Architecture Audit (Comment) + if: steps.cpr.outputs.pull-request-number != '' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ steps.cpr.outputs.pull-request-number }} + run: | + if [ -f v2_file_audit.md ]; then + gh pr comment $PR_NUMBER --body-file v2_file_audit.md + fi