From 01174cdd3e607cd15b5b56c8e421a35a3877258a Mon Sep 17 00:00:00 2001 From: "circleci-app[bot]" <127350680+circleci-app[bot]@users.noreply.github.com> Date: Thu, 5 Nov 2026 01:28:04 +0000 Subject: [PATCH] feat: add YouTube API v3 worker deploy job and fix CI workflow failures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Add deploy-worker CircleCI job that type-checks and deploys the YouTube API v3 Cloudflare Worker (src/youtube-worker.ts) to Cloudflare via wrangler. Deployment is conditional on CLOUDFLARE_API_TOKEN being set; otherwise the job validates the TypeScript source and exits cleanly. 2. Fix node-checks job: add `npm install` step for functions/ before running ESLint and tsc — the job was failing because functions/ node_modules was never populated (pnpm install only covers the root workspace). 3. Fix functions/package.json: - Remove duplicate firebase-admin key; JSON parsers take the last value (^10.3.0), which is incompatible with firebase-functions@7 (requires ^11-^14). Keep ^13.9.0. - Fix TypeScript devDependency from non-existent ^6.0.0 to ^5.6.0. 4. Fix Python ruff violations (PTH123 - not auto-fixable): - fix_app.py: replace open() with Path.open(), remove unused sys - fix_index.py: replace open() with Path.open() These prevented ruff check --fix from exiting 0 in python-checks. AI-Generated: true --- .circleci/config.yml | 36 +++++++++++++++++++++++++++++++++++- fix_app.py | 12 ++++++------ fix_index.py | 10 ++++++---- functions/package.json | 3 +-- 4 files changed, 48 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bb176b74..9b039167 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -29,10 +29,15 @@ jobs: steps: - checkout - run: - name: Install dependencies + name: Install pnpm and root dependencies command: | sudo npm install -g pnpm pnpm install --frozen-lockfile + - run: + name: Install functions dependencies + command: | + cd functions + npm install - run: name: Run linting command: | @@ -47,9 +52,38 @@ jobs: name: Quality GC check command: npx quality-gc run || echo "Quality GC issues found" + deploy-worker: + docker: + - image: cimg/node:20.18 + steps: + - checkout + - run: + name: Install pnpm and dependencies + command: | + sudo npm install -g pnpm + pnpm install --frozen-lockfile + - run: + name: Type check YouTube API v3 worker + command: pnpm exec tsc --noEmit + - run: + name: Deploy YouTube API v3 Worker to Cloudflare + command: | + if [ -n "${CLOUDFLARE_API_TOKEN}" ]; then + pnpm exec wrangler deploy src/youtube-worker.ts --name ytstudio + else + echo "CLOUDFLARE_API_TOKEN not configured — set it in CircleCI project env vars to enable deployment" + echo "Worker source validated via TypeScript type check" + fi + workflows: version: 2 validate: jobs: - python-checks - node-checks + - deploy-worker: + requires: + - node-checks + filters: + branches: + only: main diff --git a/fix_app.py b/fix_app.py index 247998d2..4ae61451 100644 --- a/fix_app.py +++ b/fix_app.py @@ -1,7 +1,7 @@ -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 @@ -20,16 +20,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_index.py b/fix_index.py index 353b69c1..3476e3f2 100644 --- a/fix_index.py +++ b/fix_index.py @@ -1,10 +1,12 @@ -with open('index.html', 'r') as f: +from pathlib import Path + +with Path("index.html").open() as f: content = f.read() # Add title attribute to search button -old_search = '