Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .github/workflows/ci.yml
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

> warning " > vitest@4.1.2" has incorrect peer dependency "vite@^6.0.0 || ^7.0.0 || ^8.0.0".

Likely caused by

bot/package.json

Lines 39 to 41 in be84759

"resolutions": {
"vite": "npm:vite@8.0.0-beta.18"
},

Can we install vite latest version (8.0.3) to remove it or there is a particular reason to use this beta?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown

@beeequeue beeequeue Apr 1, 2026

Choose a reason for hiding this comment

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

yes, with vitest 4.1 we can remove the override

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done via 1ebb853

Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,25 @@ jobs:
- name: Run test
run: yarn test

lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # 6.0.1
with:
persist-credentials: false

- uses: ./.github/actions/ci-setup

- name: Run format:check
run: yarn format:check

ci-ok:
name: CI OK
runs-on: ubuntu-latest
if: always()
needs: [test]
needs: [test, lint]
steps:
- name: Exit with error if some jobs are not successful
run: exit 1
Expand Down
17 changes: 17 additions & 0 deletions .oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"ignorePatterns": ["CHANGELOG.md"],
"sortImports": {
"groups": [
"builtin",
"external",
["internal", "subpath"],
"parent",
"sibling",
"index",
"side_effect",
"unknown"
],
"newlinesBetween": true
}
}
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
"typescript.tsdk": "node_modules/typescript/lib"
}
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@

## Install the bot at https://github.com/apps/changeset-bot



This bot will comment on PRs saying that either a user might need to add a changeset(note that PRs changing things like documentation generally don't need a changeset)or say that the PR is good and already has a changeset.

<img width="1552" alt="screenshot of changeset bot message from https://github.com/mitchellhamilton/manypkg/pull/18 before a changeset was added" src="https://user-images.githubusercontent.com/11481355/66183943-dc418680-e6bd-11e9-998d-e43f90a974bd.png">

<img width="1552" alt="screenshot of the changeset bot message from https://github.com/mitchellhamilton/manypkg/pull/18 showing the changeset good to go message" src="https://user-images.githubusercontent.com/11481355/66184229-cf716280-e6be-11e9-950e-0f64a31dbf15.png">


Sometimes, a contributor won't add a changeset to a PR but you might want to merge in the PR without having to wait on them to add it. To address this, this bot adds a link with the filename pre-filled to add a changeset so all you have to do is write the changeset and click commit.

<img width="1552" alt="screenshot of the changeset bot message from https://github.com/mitchellhamilton/manypkg/pull/18 focused on the create a changeset link" src="https://user-images.githubusercontent.com/11481355/66184052-3a6e6980-e6be-11e9-8e62-8fd9d49af587.png">
Expand All @@ -27,17 +24,17 @@ When writing the changeset, it should look something like this with the packages

```markdown
---
'@changesets/cli': major
'@changesets/read': minor
"@changesets/cli": major
"@changesets/read": minor
---

A very helpful description of the changes
```

---

The information below is for contributing to the bot.


## Setup

```sh
Expand Down
69 changes: 34 additions & 35 deletions app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,39 @@
# The list of events the GitHub App subscribes to.
# Uncomment the event names below to enable them.
default_events:
# - check_run
# - check_suite
# - commit_comment
# - create
# - delete
# - deployment
# - deployment_status
# - fork
# - gollum
# - issue_comment
- issues
# - label
# - milestone
# - member
# - membership
# - org_block
# - organization
# - page_build
# - project
# - project_card
# - project_column
# - public
- pull_request
# - pull_request_review
# - pull_request_review_comment
# - push
# - release
# - repository
# - repository_import
# - status
# - team
# - team_add
# - watch
# - check_run
# - check_suite
# - commit_comment
# - create
# - delete
# - deployment
# - deployment_status
# - fork
# - gollum
# - issue_comment
- issues
# - label
# - milestone
# - member
# - membership
# - org_block
# - organization
# - page_build
# - project
# - project_card
# - project_column
# - public
- pull_request
# - pull_request_review
# - pull_request_review_comment
# - push
# - release
# - repository
# - repository_import
# - status
# - team
# - team_add
# - watch

# The set of permissions needed by the GitHub App. The format of the object uses
# the permission name for the key (for example, issues) and the access type for
Expand Down Expand Up @@ -82,7 +82,7 @@ default_permissions:

# Pull requests and related comments, assignees, labels, milestones, and merges.
# https://developer.github.com/v3/apps/permissions/#permission-on-pull-requests
pull_requests: write
pull_requests: write

# Manage the post-receive hooks for a repository.
# https://developer.github.com/v3/apps/permissions/#permission-on-repository-hooks
Expand Down Expand Up @@ -124,7 +124,6 @@ default_permissions:
# https://developer.github.com/v3/apps/permissions/
# organization_administration: read


# The name of the GitHub App. Defaults to the name specified in package.json
# name: My Probot App

Expand Down
50 changes: 19 additions & 31 deletions get-changed-packages.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import nodePath from "path";
import micromatch from "micromatch";
import { ProbotOctokit } from "probot";
import fetch from "node-fetch";
import { safeLoad } from "js-yaml";
import { Packages, Tool } from "@manypkg/get-packages";

import assembleReleasePlan from "@changesets/assemble-release-plan";
import { parse as parseConfig } from "@changesets/config";
import { PreState, NewChangeset } from "@changesets/types";
import parseChangeset from "@changesets/parse";
import { PreState, NewChangeset } from "@changesets/types";
import { Packages, Tool } from "@manypkg/get-packages";
import { safeLoad } from "js-yaml";
import micromatch from "micromatch";
import fetch from "node-fetch";
import { ProbotOctokit } from "probot";

export let getChangedPackages = async ({
owner,
Expand All @@ -25,19 +26,14 @@ export let getChangedPackages = async ({
installationToken: string;
}) => {
let hasErrored = false;
let encodedCredentials = Buffer.from(
`x-access-token:${installationToken}`
).toString("base64");
let encodedCredentials = Buffer.from(`x-access-token:${installationToken}`).toString("base64");

function fetchFile(path: string) {
return fetch(
`https://raw.githubusercontent.com/${owner}/${repo}/${ref}/${path}`,
{
headers: {
Authorization: `Basic ${encodedCredentials}`,
},
}
);
return fetch(`https://raw.githubusercontent.com/${owner}/${repo}/${ref}/${path}`, {
headers: {
Authorization: `Basic ${encodedCredentials}`,
},
});
}

function fetchJsonFile(path: string) {
Expand Down Expand Up @@ -107,7 +103,7 @@ export let getChangedPackages = async ({
changesetPromises.push(
fetchTextFile(item.path).then((text) => {
return { ...parseChangeset(text), id };
})
}),
);
}
}
Expand Down Expand Up @@ -138,10 +134,7 @@ export let getChangedPackages = async ({
globs: rootPackageJsonContent.workspaces,
};
}
} else if (
rootPackageJsonContent.bolt &&
rootPackageJsonContent.bolt.workspaces
) {
} else if (rootPackageJsonContent.bolt && rootPackageJsonContent.bolt.workspaces) {
tool = {
tool: "bolt",
globs: rootPackageJsonContent.bolt.workspaces,
Expand All @@ -161,17 +154,12 @@ export let getChangedPackages = async ({
};

if (tool) {
if (
!Array.isArray(tool.globs) ||
!tool.globs.every((x) => typeof x === "string")
) {
if (!Array.isArray(tool.globs) || !tool.globs.every((x) => typeof x === "string")) {
throw new Error("globs are not valid: " + JSON.stringify(tool.globs));
}
let matches = micromatch(potentialWorkspaceDirectories, tool.globs);

packages.packages = await Promise.all(
matches.map((dir) => getPackage(dir))
);
packages.packages = await Promise.all(matches.map((dir) => getPackage(dir)));
} else {
packages.packages.push(packages.root);
}
Expand All @@ -183,14 +171,14 @@ export let getChangedPackages = async ({
await Promise.all(changesetPromises),
packages,
await configPromise.then((rawConfig) => parseConfig(rawConfig, packages)),
await preStatePromise
await preStatePromise,
);

return {
changedPackages: (packages.tool === "root"
? packages.packages
: packages.packages.filter((pkg) =>
changedFiles.some((changedFile) => changedFile.startsWith(`${pkg.dir}/`))
changedFiles.some((changedFile) => changedFile.startsWith(`${pkg.dir}/`)),
)
).map((x) => x.packageJson.name),
releasePlan,
Expand Down
Loading