Skip to content

Commit

Permalink
Merge pull request #117 from 0x4007/refactor/core-team-error-message
Browse files Browse the repository at this point in the history
refactor: core team member message
  • Loading branch information
0x4007 authored Jan 2, 2025
2 parents 2dba442 + 3153655 commit ffce533
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 22 deletions.
29 changes: 20 additions & 9 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,35 @@
"useGitignore": true,
"language": "en",
"words": [
"knip",
"mischeck",
"dataurl",
"devpool",
"knip",
"mischeck",
"mswjs",
"outdir",
"servedir",
"Supabase",
"signoff",
"sonarjs",
"supabase",
"Supabase",
"SUPABASE",
"timespans",
"typebox",
"ubiquity-os",
"signoff",
"sonarjs",
"mswjs",
"unassignment",
"unassignments"
],
"dictionaries": ["typescript", "node", "software-terms"],
"import": ["@cspell/dict-typescript/cspell-ext.json", "@cspell/dict-node/cspell-ext.json", "@cspell/dict-software-terms"],
"ignoreRegExpList": ["[0-9a-fA-F]{6}"]
"dictionaries": [
"typescript",
"node",
"software-terms"
],
"import": [
"@cspell/dict-typescript/cspell-ext.json",
"@cspell/dict-node/cspell-ext.json",
"@cspell/dict-software-terms"
],
"ignoreRegExpList": [
"[0-9a-fA-F]{6}"
]
}
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

17 changes: 7 additions & 10 deletions src/handlers/shared/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,12 @@ async function checkRequirements(context: Context, issue: Context<"issue_comment
);
} else if (!currentLabelConfiguration.roles.includes(userAssociation.role.toLowerCase() as (typeof currentLabelConfiguration.roles)[number])) {
// If we found the label in the allowed list, but the user role does not match the allowed roles, then the user cannot start this task.
throw logger.error(
`You do not have the adequate role to start this task (your role is: ${userAssociation.role}). Allowed roles are: ${currentLabelConfiguration.roles.join(", ")}.`,
{
currentLabelConfiguration,
issueLabels,
issue: issue.html_url,
userAssociation,
}
);
throw logger.error("You must be a core team member to start this task", {
currentLabelConfiguration,
issueLabels,
issue: issue.html_url,
userAssociation,
});
}
}
}
Expand Down Expand Up @@ -139,7 +136,7 @@ export async function start(
await addCommentToIssue(
context,
`
> [!WARNING]
> ${error}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ async function shouldSkipPullRequest(
}

/**
* Returns all the pull-requests pending to be approved, counting as a malus against the PR user's quota.
* Returns all the pull-requests pending approval, which count negatively against the PR author's quota.
*/
export async function getPendingOpenedPullRequests(context: Context, username: string) {
const { reviewDelayTolerance } = context.config;
Expand Down
2 changes: 1 addition & 1 deletion tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ describe("User start/stop", () => {

await expect(userStartStop(context)).rejects.toMatchObject({
logMessage: {
raw: "You do not have the adequate role to start this task (your role is: admin). Allowed roles are: contributor.",
raw: "You must be a core team member to start this task",
},
});
});
Expand Down

0 comments on commit ffce533

Please sign in to comment.