Skip to content

Commit 9c35684

Browse files
compute the list ourself
1 parent 72a1989 commit 9c35684

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ jobs:
2121
- name: Build
2222
run: pnpm run --filter='!@typespec/website' build
2323

24-
- run: pnpx pkg-pr-new publish './packages/*' --pnpm
24+
- run: pnpm tsx eng/tsp-core/pkg-pr-new.ts

eng/tsp-core/pkg-pr-new.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { execSync } from "child_process";
2+
import { readdir } from "fs/promises";
3+
import { repoRoot } from "../common/scripts/utils/common.js";
4+
import { listChangedFilesSince } from "../common/scripts/utils/git.js";
5+
6+
const files = await listChangedFilesSince(`origin/main`, { repositoryPath: repoRoot });
7+
8+
// eslint-disable-next-line no-console
9+
console.log("modified files:", files);
10+
11+
const packages = await readdir(repoRoot + "/packages", { withFileTypes: true });
12+
const paths = packages
13+
.filter((dirent) => dirent.isDirectory() && dirent.name !== "http-client-python")
14+
.map((dirent) => `packages/${dirent.name}`);
15+
16+
const modifiedPaths = paths.filter((x) => files.some((f) => f.startsWith(x)));
17+
// eslint-disable-next-line no-console
18+
console.log("Packages", { all: paths, modified: modifiedPaths });
19+
try {
20+
execSync(`pnpx pkg-pr-new publish '${paths.join(" ")}' --pnpm`, {
21+
stdio: "inherit",
22+
encoding: "utf-8",
23+
});
24+
} catch (e: any) {
25+
// eslint-disable-next-line no-console
26+
console.error("Failed to run pkg-pr-new publish");
27+
}

0 commit comments

Comments
 (0)