Skip to content

Add automated GitHub Action for issue and comment moderation based on team membership#2

Merged
rawveg merged 3 commits intomainfrom
copilot/fix-f59e52e9-2e85-4409-9c92-2377c120d997
Aug 20, 2025
Merged

Add automated GitHub Action for issue and comment moderation based on team membership#2
rawveg merged 3 commits intomainfrom
copilot/fix-f59e52e9-2e85-4409-9c92-2377c120d997

Conversation

Copy link
Contributor

Copilot AI commented Aug 20, 2025

This PR implements an automated moderation system that restricts issue creation and commenting to authorized team members only.

Problem

The repository needed a way to automatically control who can create issues and add comments, ensuring only members of designated teams have access to these features.

Solution

Added a GitHub Action workflow that:

  • Monitors issue creation: When someone opens a new issue, checks if they're a member of authorized teams
  • Monitors comment creation: When someone adds a comment, verifies their team membership
  • Takes automatic action: For non-team members:
    • Issues: Closes the issue and adds an explanatory comment
    • Comments: Immediately deletes the comment

Implementation Details

Files Added

  • .github/workflows/issue-moderation.yml - Main workflow that handles the moderation logic
  • .github/ISSUE_MODERATION.md - Documentation explaining configuration and usage

Key Features

  • Team-based access control: Uses GitHub organization teams for membership verification
  • Configurable teams: Easy to modify which teams are authorized via the allowedTeams array
  • User-friendly feedback: Provides clear explanations when issues are closed
  • Comprehensive logging: Detailed logs for all moderation activities
  • Proper permissions: Minimal required permissions (issues: write, contents: read, metadata: read)

Configuration

The workflow comes pre-configured with example teams (core-team, maintainers, admins). To customize for your organization:

const allowedTeams = [
  'your-actual-team-1',
  'your-actual-team-2',
  'your-actual-team-3'
];

Workflow Triggers

  • issues: [opened] - Activates when new issues are created
  • issue_comment: [created] - Activates when new comments are added

The action will begin automatically moderating issues and comments as soon as this PR is merged to the main branch.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: rawveg <308889+rawveg@users.noreply.github.com>
Copilot AI changed the title [WIP] Create a Github action that automatically closes and deletes any issue that has not been created by a member of one of the assigned teams. Any comments added by a non-team member should be automatically deleted too. Add automated GitHub Action for issue and comment moderation based on team membership Aug 20, 2025
Copilot AI requested a review from rawveg August 20, 2025 19:57
Modified allowed teams in configuration array
@rawveg rawveg marked this pull request as ready for review August 20, 2025 20:09
@rawveg rawveg merged commit 9bf7f32 into main Aug 20, 2025
@rawveg rawveg deleted the copilot/fix-f59e52e9-2e85-4409-9c92-2377c120d997 branch August 20, 2025 20:09
@imikerussell
Copy link

This is blowing my mind a little bit! Great addition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants