diff --git a/get-changed-packages.ts b/get-changed-packages.ts
index 2cc8522..b954c08 100644
--- a/get-changed-packages.ts
+++ b/get-changed-packages.ts
@@ -112,7 +112,7 @@ export const getChangedPackages = async ({
if (!item.path) {
continue;
}
- if (item.path.endsWith("/package.json")) {
+ if (nodePath.basename(item.path) === "package.json") {
const dirPath = nodePath.dirname(item.path);
potentialWorkspaceDirectories.push(dirPath);
} else if (item.path === "pnpm-workspace.yaml") {
@@ -132,7 +132,10 @@ export const getChangedPackages = async ({
const id = res[1];
changesetPromises.push(
- fetchTextFile(item.path).then((text) => ({ ...parseChangeset(text), id })),
+ fetchTextFile(item.path).then((text) => ({
+ ...parseChangeset(text),
+ id,
+ })),
);
}
}
diff --git a/test/index.test.ts b/test/index.test.ts
index f3198f9..0187b1a 100644
--- a/test/index.test.ts
+++ b/test/index.test.ts
@@ -457,6 +457,75 @@ describe.concurrent("changeset-bot", () => {
`);
});
+ it("shows release details for the root package when workspaces explicitly include dot", async ({
+ expect,
+ task,
+ }) => {
+ const probot = setupProbot(task.id);
+ const { requests } = usePrState(server, {
+ files: {
+ ".changeset/config.json": JSON.stringify({}),
+ ".changeset/root-change.md": [
+ {
+ status: "added",
+ },
+ `---
+"root-package": patch
+---
+
+thing
+`,
+ ],
+ "package.json": JSON.stringify({
+ name: "root-package",
+ version: "1.0.0",
+ workspaces: [".", "packages/*"],
+ }),
+ "packages/a/package.json": JSON.stringify({
+ name: "pkg-a",
+ }),
+ },
+ comments: [],
+ });
+
+ await probot.receive({
+ name: "pull_request",
+ payload: pullRequestOpen,
+ } as never);
+
+ const commentRequests = requests.filter((request) => request.path.includes("/comments"));
+
+ expect(commentRequests).toMatchInlineSnapshot(`
+ [
+ {
+ "body": {
+ "body": "### 🦋 Changeset detected
+
+ Latest commit: c4d7edfd758bd44f7d4264fb55f6033f56d79540
+
+ **The changes in this PR will be included in the next version bump.**
+
+ This PR includes changesets to release 1 package
+
+ | Name | Type |
+ | ------------ | ----- |
+ | root-package | Patch |
+
+
+
+ Not sure what this means? [Click here to learn what changesets are](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md).
+
+ [Click here if you're a maintainer who wants to add another changeset to this PR](https://github.com/changesets/bot/new/test?filename=.changeset/.md&value=---%0A%0A---%0A%0Athing%0A)
+
+ ",
+ },
+ "method": "POST",
+ "path": "/repos/changesets/bot/issues/2/comments",
+ },
+ ]
+ `);
+ });
+
it("includes only changed yarn workspace packages in the add-changeset link", async ({
expect,
task,