From e0948c90245348a3668885801297c0d494926b1d Mon Sep 17 00:00:00 2001 From: "circleci-app[bot]" <127350680+circleci-app[bot]@users.noreply.github.com> Date: Fri, 16 Oct 2026 19:33:38 +0000 Subject: [PATCH] feat: deploy YouTube API v3 worker and fix CI workflow failures - Add deploy-worker job to .circleci/config.yml targeting Cloudflare Workers with CLOUDFLARE_API_TOKEN/CLOUDFLARE_ACCOUNT_ID env vars on main branch - Upgrade node-checks job to cimg/node:22.11 with separate root (pnpm) and functions (npm --legacy-peer-deps) install steps - Add validate and deploy workflows to organize CI/CD stages - Fix python-checks workflow failures: replace builtin open() with Path.open() across fix_app.py and fix_index.py so ruff PTH123 rule passes clean - Auto-fix 11 remaining ruff violations (Q000, UP015, Q004, F401) across Python utility scripts; reformat fix_deps.py - Fix functions/package.json: remove duplicate firebase-admin entry, remove extraneous lint dep, downgrade typescript from ^6 to ^5.6.0, set engines.node to >=20 - Update functions/package-lock.json to match fixed package.json - Reformat functions/.eslintrc.js from minified to readable - Update pnpm-workspace.yaml: add explicit packages section and extend allowBuilds with @parcel/watcher, protobufjs, unrs-resolver - Add functions/pnpm-lock.yaml generated from pnpm install in functions/ AI-Generated: true --- .circleci/config.yml | 47 +- fix_app.py | 17 +- fix_deps.py | 10 +- fix_index.py | 12 +- functions/.eslintrc.js | 34 +- functions/package-lock.json | 25777 ++++------------------------------ functions/package.json | 8 +- functions/pnpm-lock.yaml | 6597 +++++++++ pnpm-workspace.yaml | 6 + 9 files changed, 9669 insertions(+), 22839 deletions(-) create mode 100644 functions/pnpm-lock.yaml diff --git a/.circleci/config.yml b/.circleci/config.yml index bb176b7..8c71649 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,31 +25,58 @@ jobs: node-checks: docker: - - image: cimg/node:20.18 + - image: cimg/node:22.11 steps: - checkout - run: - name: Install dependencies + name: Install pnpm and root dependencies command: | sudo npm install -g pnpm pnpm install --frozen-lockfile - run: - name: Run linting - command: | - cd functions - npm run lint -- --max-warnings 0 + name: TypeScript type check (worker) + command: pnpm run type-check - run: - name: TypeScript type check - command: | - cd functions - npx tsc --noEmit + name: Install functions dependencies + command: npm install --legacy-peer-deps --prefix functions + - run: + name: Run linting (functions) + command: npm run lint --prefix functions -- --max-warnings 0 + - run: + name: TypeScript type check (functions) + command: npm run build --prefix functions - run: name: Quality GC check command: npx quality-gc run || echo "Quality GC issues found" + deploy-worker: + docker: + - image: cimg/node:22.11 + steps: + - checkout + - run: + name: Install pnpm and dependencies + command: | + sudo npm install -g pnpm + pnpm install --frozen-lockfile + - run: + name: Deploy YouTube API Worker to Cloudflare + command: pnpm run deploy:worker + environment: + CLOUDFLARE_API_TOKEN: $CLOUDFLARE_API_TOKEN + CLOUDFLARE_ACCOUNT_ID: $CLOUDFLARE_ACCOUNT_ID + workflows: version: 2 + validate: jobs: - python-checks - node-checks + + deploy: + jobs: + - deploy-worker: + filters: + branches: + only: main diff --git a/fix_app.py b/fix_app.py index 247998d..8dd1092 100644 --- a/fix_app.py +++ b/fix_app.py @@ -1,13 +1,16 @@ -import sys +from pathlib import Path -filepath = 'js/app.js' -with open(filepath, 'r') as f: +filepath = Path("js/app.js") +with filepath.open() as f: lines = f.readlines() # Part 1: DOM elements for i, line in enumerate(lines): if "themeMenu: document.getElementById('themeMenu')," in line: - lines.insert(i + 1, " episodesNavBtn: document.querySelector('[data-action=\"scroll-to-episodes\"]'),\n") + lines.insert( + i + 1, + " episodesNavBtn: document.querySelector('[data-action=\"scroll-to-episodes\"]'),\n", + ) lines.insert(i + 2, " episodesSection: document.getElementById('episodesSection'),\n") break @@ -20,16 +23,16 @@ " DOM.episodesNavBtn.addEventListener('click', () => {\n", " DOM.episodesSection.scrollIntoView({ behavior: 'smooth' });\n", " if (document.body.classList.contains('mobile-nav-active')) {\n", - " document.body.classList.remove('mobile-nav-active');\n", + " document.body.classList.remove('mobile-nav-active');\n", " if (DOM.menuToggle) DOM.menuToggle.setAttribute('aria-expanded', 'false');\n", " }\n", " });\n", " }\n", - "\n" + "\n", ] for idx, new_line in enumerate(scroll_listener): lines.insert(i + idx, new_line) break -with open(filepath, 'w') as f: +with filepath.open("w") as f: f.writelines(lines) diff --git a/fix_deps.py b/fix_deps.py index 34cbd97..f59b27b 100644 --- a/fix_deps.py +++ b/fix_deps.py @@ -15,12 +15,12 @@ # Maybe the CI is running against a different state of the PR? # Let's just make sure trigger-circleci-pipeline and circletui are in package.json if they are in the lockfile. -if 'dependencies' not in pkg: - pkg['dependencies'] = {} +if "dependencies" not in pkg: + pkg["dependencies"] = {} -pkg['dependencies']['trigger-circleci-pipeline'] = '^1.12.1' -pkg['dependencies']['circletui'] = '^1.0.3' -pkg['dependencies']['@circleci/circleci-config-sdk'] = '^0.12.5' +pkg["dependencies"]["trigger-circleci-pipeline"] = "^1.12.1" +pkg["dependencies"]["circletui"] = "^1.0.3" +pkg["dependencies"]["@circleci/circleci-config-sdk"] = "^0.12.5" with Path("package.json").open("w") as f: json.dump(pkg, f, indent=2) diff --git a/fix_index.py b/fix_index.py index 353b69c..28c62a4 100644 --- a/fix_index.py +++ b/fix_index.py @@ -1,10 +1,10 @@ -with open('index.html', 'r') as f: - content = f.read() +from pathlib import Path + +content = Path("index.html").read_text() # Add title attribute to search button -old_search = '