Skip to content

ci: skip chat-lib tests when pull requests do not touch Copilot - #342257

Merged
Alexandru Dima (alexdima) merged 1 commit into
mainfrom
agents/skip-chat-lib-tests-opportunity
Oct 17, 2026
Merged

Alexandru Dima (alexdima) merged 1 commit into
mainfrom
agents/skip-chat-lib-tests-opportunity

Conversation

@alexdima

Copy link
Copy Markdown
Member

The chat-lib tests workflow runs on every pull request, on Ubuntu, macOS and Windows, even when a pull request does not touch the Copilot extension (for example #342242, which only changed a test under src/vs/). Chat-lib is extracted only from extensions/copilot/, src/vscode-dts/ and src/typings/thenable.d.ts, all of which are already covered by the copilot rule in detect-changes.

Changes

  • pr.yml: adds three chat-lib jobs gated on needs.changes.outputs.copilot, with the same fail-open if: as the Copilot jobs. The job names are unchanged (chat-lib tests (ubuntu-latest|macos-latest|windows-latest)), so the required checks still match, and a skipped job satisfies them.
  • Why three jobs instead of a matrix: GitHub does not expand a matrix job that is skipped by a job-level if: (Skipping a matrix job hangs the Pull Request when inner-matrix jobs are required status checks actions/runner#952). It would report a single chat-lib tests (${{ matrix.os }}) check, and the per-OS required checks would stay pending.
  • .github/actions/test-chat-lib: a new composite action that holds the shared setup/extract/install/build/test steps, so the three jobs cannot drift apart.
  • chat-lib-package.yml: kept as a manual-only (workflow_dispatch) workflow so chat-lib can still be tested on a branch without a pull request. Its checks use different names (chat-lib manual tests (…)), so a manual run never satisfies or fails the required checks.
  • detect.ts: adds .github/actions/test-chat-lib/ to the copilot rule.

npm publishing is unaffected; it runs in Azure Pipelines (extensions/copilot/build/npm-package*.yml) and runs its own chat-lib tests.

Notes for reviewers

  • The chat-lib checks now belong to the Code OSS workflow instead of chat-lib tests. Branch protection matches on check names, which are unchanged.
  • Reusing the copilot output also runs chat-lib when the root package.json, the ESLint configuration or the node_modules cache inputs change. This is broader than strictly needed, but keeps a single rule.

How to test

  • Called detectChanges with stubbed GitHub inputs: the chat: finish image reveal tests without waiting for the real-time deadline #342242 file gives copilot = false, while extensions/copilot/..., src/vscode-dts/vscode.d.ts and .github/actions/test-chat-lib/action.yml each give copilot = true.
  • Parsed the workflow and action YAML; the three job names match the required checks exactly.
  • npm run eslint -- .github/actions/detect-changes/detect.ts: passed.
  • Strict tsc --noEmit on detect.ts: passed.
  • Not run locally: the GitHub Actions runs themselves. This pull request touches .github/workflows/pr.yml, a shared path, so CI on it runs the chat-lib jobs. Skipping can only be confirmed on a later core-only pull request.
  • The manual workflow can only be dispatched after merge, because GitHub runs workflow_dispatch from the default branch.

Move the chat-lib jobs into pr.yml and gate them on the existing copilot change-detection output, so core-only pull requests no longer build and test chat-lib on three platforms. The jobs are separate rather than a matrix because a matrix job skipped by a job-level if: is never expanded and the per-OS required checks would not report. Shared steps live in a composite action, which the now manual-only chat-lib workflow also uses.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 17, 2026 09:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The changes preserve check names and fail-open gating, with no actionable defects identified in static review.

No open issues 🎉

What changed in this PR

Moves chat-lib PR checks into the Code OSS workflow so unrelated changes can skip them while preserving required check names.

Changes:

  • Adds three OS-specific jobs gated by Copilot change detection.
  • Shares test steps through a composite action.
  • Retains manual testing with distinct check names.

No actionable findings remain. Hosted execution and skipped-check reporting remain unverified.

File Description
.github/​workflows/​pr.yml Adds gated chat-lib jobs for all three platforms.
.github/​workflows/​chat-lib-package.yml Makes testing manual-only and reuses shared steps.
.github/​actions/​test-chat-lib/​action.yml Centralizes extraction, installation, build, and tests.
.github/​actions/​detect-changes/​detect.ts Includes the shared action in Copilot change detection.

Review effort: Balanced

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.

3 participants