Skip to content

feat: auto-discover workspaces and fix Dependabot alerts across all manifests#2163

Merged
TalZaccai merged 3 commits intomainfrom
talzacc/docs-workspace-support
Apr 9, 2026
Merged

feat: auto-discover workspaces and fix Dependabot alerts across all manifests#2163
TalZaccai merged 3 commits intomainfrom
talzacc/docs-workspace-support

Conversation

@TalZaccai
Copy link
Copy Markdown
Contributor

@TalZaccai TalZaccai commented Apr 8, 2026

Changes

Auto-discover workspaces from Dependabot alerts

The workflow previously only processed ts/ alerts. Now it automatically discovers which workspaces have open npm alerts by querying the Dependabot API:

gh api .../dependabot/alerts?state=open \
  --jq '[.[] | select(.ecosystem == "npm") | .manifest_path | split("/")[0]] | unique'

New workspaces (e.g. docs/, python/) are picked up automatically ΓÇö no hardcoded paths to maintain.

Script: workspace-aware alert filtering

  • Derives ROOT from git root + workspace prefix via detectWorkspaceRoot(), so running from a subdirectory (e.g. ts/tools) still targets the correct workspace root (ts/)
  • Filters Dependabot alerts by manifest_path so each workspace only processes its own alerts
  • Graceful fallback if git rev-parse fails (non-git context)

Bug fixed: Previously, alerts from docs/pnpm-lock.yaml (e.g. liquidjs) were silently misclassified as "already fixed" because pnpm why found nothing in the ts/ workspace.

Workflow: unified workspace loop

  • Single loop handles all workspaces: install deps ΓåÆ analyse ΓåÆ fix per-package ΓåÆ build-verify ΓåÆ rollback on failure
  • All workspaces install uniformly inside the loop via corepack enable && pnpm install — no special-casing for ts
  • Install failures skip the workspace with a warning instead of silently continuing
  • Post-fix pnpm install uses --frozen-lockfile (plus --strict-peer-dependencies for ts) and rolls back on install failure
  • Script exit code (fix_exit) now tracked ΓÇö warns and counts failures when script exits non-zero with no file changes

Tested locally

  • Workspace discovery API returns docs and ts Γ£à
  • Script from ts/: filters to 12/15 alerts matching ts/ Γ£à
  • Script from docs/: filters to 3/15 alerts matching docs/ (liquidjs) Γ£à

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Extends the Dependabot auto-fix tooling and workflow so alerts are processed per-workspace (ts/ vs docs/) instead of incorrectly treating cross-workspace alerts as already resolved.

Changes:

  • Updated the fix script to use the current working directory as the command root and filter alerts by manifest_path for the active workspace.
  • Enhanced the GitHub Actions workflow to install docs dependencies and iterate through multiple workspaces when applying fixes.
  • Adjusted PR creation gating to account for multi-workspace behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
ts/tools/scripts/fix-dependabot-alerts.mjs Uses cwd-based ROOT and filters Dependabot alerts to the current workspace based on manifest_path.
.github/workflows/fix-dependabot-alerts.yml Installs docs deps and loops over workspaces to analyze/apply/build-check fixes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/fix-dependabot-alerts.yml Outdated
Comment thread ts/tools/scripts/fix-dependabot-alerts.mjs Outdated
Comment thread ts/tools/scripts/fix-dependabot-alerts.mjs Outdated
Comment thread .github/workflows/fix-dependabot-alerts.yml
Comment thread .github/workflows/fix-dependabot-alerts.yml Outdated
@TalZaccai TalZaccai force-pushed the talzacc/docs-workspace-support branch from 184d2c4 to 85922f6 Compare April 8, 2026 19:07
@TalZaccai TalZaccai force-pushed the talzacc/docs-workspace-support branch from 85922f6 to ad6ffc7 Compare April 8, 2026 23:52
@TalZaccai TalZaccai changed the title feat: extend Dependabot script to support docs workspace feat: auto-discover workspaces and fix Dependabot alerts across all manifests Apr 8, 2026
@TalZaccai TalZaccai requested a review from Copilot April 8, 2026 23:58
@TalZaccai TalZaccai force-pushed the talzacc/docs-workspace-support branch from ad6ffc7 to 7fea502 Compare April 8, 2026 23:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ts/tools/scripts/fix-dependabot-alerts.mjs Outdated
Comment thread ts/tools/scripts/fix-dependabot-alerts.mjs
Comment thread .github/workflows/fix-dependabot-alerts.yml Outdated
Comment thread .github/workflows/fix-dependabot-alerts.yml
Comment thread .github/workflows/fix-dependabot-alerts.yml
TalZaccai and others added 3 commits April 9, 2026 12:22
The script now auto-detects its workspace from cwd relative to the
git root and filters alerts by manifest_path. Running from ts/ only
processes ts/ alerts; running from docs/ only processes docs/ alerts.

Previously, docs/ alerts (e.g. liquidjs) were silently misclassified
as already fixed because pnpm why found nothing in the ts/ workspace.

The workflow now includes a docs-specific step that installs docs
dependencies and runs the script from the docs/ directory.

Also changed ROOT from a hardcoded path to process.cwd() so pnpm
commands and package.json reads target the correct workspace.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… fix_exit tracking

- Derive ROOT from git root + workspace prefix so subdirectory runs
  (e.g. ts/tools) still target the correct workspace root
- Align fetchAlerts() wsPrefix with ROOT instead of cwd
- Fail fast on pnpm install errors for non-ts workspaces (skip with warning)
- Use --frozen-lockfile (+ --strict-peer-dependencies for ts) on post-fix install
- Roll back on install failure, not just build failure
- Track fix_exit: warn and count failures when script exits non-zero with no changes

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… in loop

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@TalZaccai TalZaccai force-pushed the talzacc/docs-workspace-support branch from 9026b6e to b3c92b5 Compare April 9, 2026 19:22
@TalZaccai TalZaccai temporarily deployed to development-fork April 9, 2026 19:22 — with GitHub Actions Inactive
@TalZaccai TalZaccai temporarily deployed to development-fork April 9, 2026 19:22 — with GitHub Actions Inactive
@TalZaccai TalZaccai enabled auto-merge April 9, 2026 19:23
@TalZaccai TalZaccai added this pull request to the merge queue Apr 9, 2026
Merged via the queue into main with commit b234628 Apr 9, 2026
21 checks passed
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.

2 participants