Skip to content

Latest commit

 

History

History
304 lines (202 loc) · 6.9 KB

README.md

File metadata and controls

304 lines (202 loc) · 6.9 KB
logo

Repo Command

A GitHub bot that automates repository management through commands and automatic labeling.

License: MIT GitHub release

Features

Automatic Labeling

  • Labels new PRs as "ready for review"
  • Adds "approved" label when PR is approved
  • Adds "changes requested" when changes are requested
  • Adds "merged" label to merged PRs
  • Adds "fixed" label to closed bug issues
  • Adds "implemented" label to closed feature/enhancement issues

Commands

Use these commands in PR/issue comments:

  • /approve - Approve a pull request
  • /merge - Merge a pull request
  • /close - Close an issue or pull request
  • /wip - Mark as work in progress
  • /label <name> - Add labels
  • /request-info - Request more information

Smart Automations

  • Requests more information when issue descriptions are too short
  • Welcomes first-time contributors
  • Manages labels based on PR/issue status
  • Automatically removes labels when conditions change

Installation

  1. Install the GitHub App
  2. Grant access to your repositories
  3. Optionally create a config file (see Configuration section)

Usage

Commands

  1. Approve PR

    /approve
    

    Approves the pull request (requires write access)

image
  1. Merge PR

    /merge
    

    Merges the pull request using rebase strategy (requires write access)

image
  1. Close

    /close
    

    Closes a issue/PR

    image
  2. Add Labels

    /label bug documentation
    

    Adds one or more labels to the issue/PR

image
  1. Work in Progress

    /wip
    

    Marks PR as work in progress

image
  1. Request Information
    /request-info
    
    Requests additional information from the author
image

Automations

The bot includes several automatic behaviors that can be enabled or disabled:

  1. Request more info (requestMoreInfo)

    • Request more information from user when description is too short
    • Triggers on: Issue opened
image
  1. Ready for Review (addReadyForReview)

    • Adds "ready for review" label to new pull requests
    • Triggers on: Pull request opened
image
  1. Approval Labels (addApprovedLabel)

    • Adds "approved" label when PR is approved
    • Removes "changes requested" label if present
    • Triggers on: Pull request review submitted
image
  1. Changes Requested (addChangesRequestedLabel)

    • Adds "changes requested" label when changes are requested
    • Removes "approved" and "ready for review" labels
    • Triggers on: Pull request review submitted
image
  1. Merged Label (addMergedLabel)

    • Adds "merged" label when PR is merged
    • Removes review-related labels
    • Triggers on: Pull request closed (merged)
image
  1. Welcome Messages (welcomeContributor, welcomeIssue)
    • Welcomes first-time contributors
    • Provides helpful onboarding information
    • Triggers on: First PR or issue
image

Configuration

Create a .github/repo-command.yml file in your repository:

# Minimum length required for issue/PR descriptions
minBodyLength: 50

# Enable/disable commands
commands:
    wip: true
    approve: true
    close: true
    label: true
    merge: true
    requestInfo: true

# Enable/disable automations
automations:
    addReadyForReview: true
    addApprovedLabel: true
    addChangesRequestedLabel: true
    addMergedLabel: true
    requestMoreInfo: true
    addLabelsOnClose: true
    welcomeContributor: true
    welcomeIssue: true

# Configure labels
labels:
    wip: "work in progress"
    readyForReview: "ready for review"
    approved: "approved"
    changesRequested: "changes requested"
    needsMoreInfo: "needs more info"
    merged: "merged"
    bug: "bug"
    feature: "feature"
    enhancement: "enhancement"
    fixed: "fixed"
    implemented: "implemented"

# Configure messages
messages:
    welcomeContributor: |
        Thanks for your first pull request, @{user}! 🎉
        The team will review your changes soon.
    welcomeIssue: |
        Thanks for opening your first issue, @{user}! 🎉
    requestMoreInfo: |
        Hey @{user}! Please provide more details in your {type}.
    moreInfoAdded: |
        Thanks @{user} for adding more information!

Development

Prerequisites

  • Node.js >= 16
  • npm or yarn
  • A GitHub account

Local Setup

  1. Clone the repository
git clone [email protected]:aayushchugh/repo-command.git
cd repo-command
  1. Install dependencies
npm install
  1. Create a .env file:
APP_ID=your_app_id
PRIVATE_KEY=your_private_key
WEBHOOK_SECRET=your_webhook_secret
  1. Start the bot
npm run dev

Docker Support

Run using Docker:

# Using Docker Compose
docker compose up -d

# Or using Docker directly
docker build -t repo-command .
docker run -d \
  -p 3000:3000 \
  --env-file .env \
  --name repo-command \
  repo-command

Contributing

Contributions are welcome! Please read our Contributing Guide.

Support

For support:

License

MIT © Ayush Chugh

docker run -d
-p 3000:3000
--env-file .env
--name repo-command
repo-command


The bot will be available at `http://localhost:3000`.