Skip to content

Commit

Permalink
fix: your not assigned comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyrxng committed Jul 22, 2024
1 parent aae3cba commit f3109fc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
7 changes: 1 addition & 6 deletions src/handlers/shared/stop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,12 @@ export async function stop(context: Context, issue: Context["payload"]["issue"],

// is there an assignee?
const assignees = issue.assignees ?? [];
if (assignees.length == 0) {
logger.error("No assignees found for issue", { issueNumber });
await addCommentToIssue(context, "```diff\n! You are not assigned to this task.\n```");
return { output: "No assignees found for this task" };
}

// should unassign?
const whoToUnassign = assignees.find((assignee) => assignee?.login.toLowerCase() === sender.login.toLowerCase());

if (!whoToUnassign) {
logger.error("You are not assigned to this task", { issueNumber, user: sender.login });
await addCommentToIssue(context, "```diff\n! You are not assigned to this task.\n```");
return { output: "You are not assigned to this task" };
}

Expand Down
4 changes: 2 additions & 2 deletions src/utils/issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,14 @@ async function getOpenedPullRequests(context: Context, username: string): Promis
* `Related to #123`
*/
export function issueLinkedViaPrBody(prBody: string | null, issueNumber: number): boolean {
// eslint-disable-next-line no-useless-escape
const regex =
const regex = // eslint-disable-next-line no-useless-escape
/(?:Resolves|Fixes|Closes|Depends on|Related to) #(\d+)|https:\/\/(?:www\.)?github.com\/([^\/]+)\/([^\/]+)\/(issue|issues)\/(\d+)|#(\d+)/gi;
const matches = prBody?.match(regex);

if (!matches) {
return false;
}

let issueId;

matches.map((match) => {
Expand Down

0 comments on commit f3109fc

Please sign in to comment.