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

Fix loading object author from auto rc #2172

Merged
merged 1 commit into from
Mar 20, 2022
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
17 changes: 15 additions & 2 deletions packages/core/src/__tests__/validate-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,17 @@ describe("validateConfig", () => {
).toStrictEqual([]);
});

test("should allow author as an object", async () => {
expect(
await validateAutoRc({
author: {
name: "Andrew",
email: "test@email.com",
},
})
).toStrictEqual([]);
});

test("should catch errors in labels", async () => {
expect(
await validateAutoRc({
Expand Down Expand Up @@ -479,9 +490,11 @@ describe("validatePlugin", () => {
// Check no validation issues with intersected options
expect(
await validatePlugins(hook, {
plugins: [["test-plugin", { auth: "app", channels: ['foo'], atTarget: 'foo' }]],
plugins: [
["test-plugin", { auth: "app", channels: ["foo"], atTarget: "foo" }],
],
})
).toStrictEqual([]);
).toStrictEqual([]);
});

test("should validate plugin configuration - array of configurations", async () => {
Expand Down
9 changes: 8 additions & 1 deletion packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ import { ILabelDefinition, labelDefinition } from "./semver";

const author = t.partial({
/** The name and email of the author to make commits with */
author: t.string,
author: t.union([
t.string,
t.interface({
/** The name of the author to make commits with */ name: t.string,
/** The email of the author to make commits with */
email: t.string,
}),
]),
/** The name of the author to make commits with */
name: t.string,
/** The email of the author to make commits with */
Expand Down