Skip to content

Commit

Permalink
fix: safety feature of disabling maintainers to use the bot disabled …
Browse files Browse the repository at this point in the history
…for private repos
  • Loading branch information
Varun-Kolanu committed Nov 17, 2024
1 parent 76cd9c9 commit bf05201
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ See [Contributing guide][contributing] for contributing to the project.

## Note for maintainers:

Assignment and Abandoning of issues doesn't work for users having permissions admin, maintainer or triage, since they already can assign themselves and also to avoid accidental assignment of the issue while explaining a contributor how to claim.
Assignment and Abandoning of issues doesn't work for users having permissions admin, maintainer or triage in public repos, since they already can assign themselves and also to avoid accidental assignment of the issue while explaining a contributor how to claim.

But the exception is for private repos, since it becomes essential to make a normal contributor too a collaborator to allow them to access the repo and hence this safety feature may interfere with the main functionality.

# Usage

Expand Down
7 changes: 3 additions & 4 deletions src/handlers/issue_comment.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import { skipCommenters } from "../helpers/skip_commenters.js";
import getAssignedIssues from "../helpers/get_assigned_issues.js";
import { issueOrIssues, thisOrThese } from "../helpers/pluralize.js";
import { getConfig } from "../helpers/config.js";
import { Request, checkRequest } from "../helpers/check_request.js";
import { Assignment, shouldAssign } from "../helpers/should_assign.js";
import { UnAssignment, shouldUnAssign } from "../helpers/should_unassign.js";

export default async function issueCommentHandler() {
// Fetching comment
const { comment } = this.context.payload;
const { comment, repository } = this.context.payload;
const commenter = comment.user.login;

// If commenter is bot or maintainer.
if (skipCommenters(commenter, this.maintainers)) return;
// If repository is pubic and commenter is bot or maintainer.
if (!repository.private && skipCommenters(commenter, this.maintainers)) return;

// Get assignees of the issue
const assignees = this.issue.assignees.map(
Expand Down

0 comments on commit bf05201

Please sign in to comment.