Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle capital X in semver bump list #1849

Merged
merged 1 commit into from Mar 3, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions plugins/pr-body-labels/__tests__/pr-body-labels.test.ts
Expand Up @@ -37,6 +37,23 @@ describe("Pr-Body-Labels Plugin", () => {
expect(addLabelToPr).toHaveBeenCalledWith(1, "patch");
});

test("add labels present in project capital X", async () => {
const plugin = new PrBodyLabels();
const hooks = makeHooks();
const addLabelToPr = jest.fn();

plugin.apply({
hooks,
labels: [{ name: "patch" }],
git: { addLabelToPr },
} as any);

await hooks.prCheck.promise({
pr: { body: "- [X] `patch`", number: 1 },
} as any);
expect(addLabelToPr).toHaveBeenCalledWith(1, "patch");
});

test("not add labels in disabledLabels list", async () => {
const plugin = new PrBodyLabels({ disabledLabels: ["patch"] });
const hooks = makeHooks();
Expand Down
6 changes: 5 additions & 1 deletion plugins/pr-body-labels/src/index.ts
Expand Up @@ -32,8 +32,12 @@ export default class PrBodyLabelsPlugin implements IPlugin {

await Promise.all(
auto.labels.map(async (label) => {
const hasCheckedLabel =
pr.body?.includes(`- [x] \`${label.name}\``) ||
pr.body?.includes(`- [X] \`${label.name}\``);

if (
pr.body?.includes(`- [x] \`${label.name}\``) &&
hasCheckedLabel &&
!this.options.disabledLabels.includes(label.name)
) {
await auto.git?.addLabelToPr(pr.number, label.name);
Expand Down