Skip to content

Commit

Permalink
Merge pull request ubiquity-os-marketplace#101 from rndquu/ci/fix-pre…
Browse files Browse the repository at this point in the history
…ttier

ci: fix prettier
  • Loading branch information
rndquu authored Dec 4, 2024
2 parents 973ea32 + ada27fe commit 70a9619
Showing 1 changed file with 43 additions and 29 deletions.
72 changes: 43 additions & 29 deletions src/types/plugin-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,23 @@ export enum Role {
COLLABORATOR = "COLLABORATOR",
}

const rolesWithReviewAuthority = T.Array(T.Enum(Role),
{
default: [Role.OWNER, Role.ADMIN, Role.MEMBER, Role.COLLABORATOR],
uniqueItems: true,
description: "When considering a user for a task: which roles should be considered as having review authority? All others are ignored.",
examples: [[Role.OWNER, Role.ADMIN], [Role.MEMBER, Role.COLLABORATOR]]
});
const rolesWithReviewAuthority = T.Array(T.Enum(Role), {
default: [Role.OWNER, Role.ADMIN, Role.MEMBER, Role.COLLABORATOR],
uniqueItems: true,
description: "When considering a user for a task: which roles should be considered as having review authority? All others are ignored.",
examples: [
[Role.OWNER, Role.ADMIN],
[Role.MEMBER, Role.COLLABORATOR],
],
});

const maxConcurrentTasks = T.Transform(T.Record(T.String(), T.Integer(),
{
const maxConcurrentTasks = T.Transform(
T.Record(T.String(), T.Integer(), {
default: { member: 10, contributor: 2 },
description: "The maximum number of tasks a user can have assigned to them at once, based on their role.",
examples: [{ member: 5, contributor: 1 }]
}
))
examples: [{ member: 5, contributor: 1 }],
})
)
.Decode((obj) => {
// normalize the role keys to lowercase
obj = Object.keys(obj).reduce(
Expand All @@ -49,27 +51,39 @@ const maxConcurrentTasks = T.Transform(T.Record(T.String(), T.Integer(),

export const pluginSettingsSchema = T.Object(
{
reviewDelayTolerance: T.String({ default: "1 Day", examples: ["1 Day", "5 Days"], description: "When considering a user for a task: if they have existing PRs with no reviews, how long should we wait before 'increasing' their assignable task limit?" }),
taskStaleTimeoutDuration: T.String({ default: "30 Days", examples: ["1 Day", "5 Days"], description: "When displaying the '/start' response, how long should we wait before considering a task 'stale' and provide a warning?" }),
startRequiresWallet: T.Boolean({ default: true, description: "If true, users must set their wallet address with the /wallet command before they can start tasks." }),
reviewDelayTolerance: T.String({
default: "1 Day",
examples: ["1 Day", "5 Days"],
description:
"When considering a user for a task: if they have existing PRs with no reviews, how long should we wait before 'increasing' their assignable task limit?",
}),
taskStaleTimeoutDuration: T.String({
default: "30 Days",
examples: ["1 Day", "5 Days"],
description: "When displaying the '/start' response, how long should we wait before considering a task 'stale' and provide a warning?",
}),
startRequiresWallet: T.Boolean({
default: true,
description: "If true, users must set their wallet address with the /wallet command before they can start tasks.",
}),
maxConcurrentTasks: maxConcurrentTasks,
assignedIssueScope: T.Enum(AssignedIssueScope,
{
default: AssignedIssueScope.ORG,
description: "When considering a user for a task: should we consider their assigned issues at the org, repo, or network level?",
examples: [AssignedIssueScope.ORG, AssignedIssueScope.REPO, AssignedIssueScope.NETWORK]
}
),
emptyWalletText: T.String({ default: "Please set your wallet address with the /wallet command first and try again.", description: "a message to display when a user tries to start a task without setting their wallet address." }),
assignedIssueScope: T.Enum(AssignedIssueScope, {
default: AssignedIssueScope.ORG,
description: "When considering a user for a task: should we consider their assigned issues at the org, repo, or network level?",
examples: [AssignedIssueScope.ORG, AssignedIssueScope.REPO, AssignedIssueScope.NETWORK],
}),
emptyWalletText: T.String({
default: "Please set your wallet address with the /wallet command first and try again.",
description: "a message to display when a user tries to start a task without setting their wallet address.",
}),
rolesWithReviewAuthority: T.Transform(rolesWithReviewAuthority)
.Decode((value) => value.map((role) => role.toUpperCase()))
.Encode((value) => value.map((role) => Role[role as keyof typeof Role])),
requiredLabelsToStart: T.Array(T.String(),
{
default: [],
description: "If set, a task must have at least one of these labels to be started.",
examples: [["Priority: 5 (Emergency)"], ["Good First Issue"]]
}),
requiredLabelsToStart: T.Array(T.String(), {
default: [],
description: "If set, a task must have at least one of these labels to be started.",
examples: [["Priority: 5 (Emergency)"], ["Good First Issue"]],
}),
},
{
default: {},
Expand Down

0 comments on commit 70a9619

Please sign in to comment.