Automate common GitHub repository tasks with a single command.
RepoPilot is an open-source Node.js tool that talks to the GitHub REST API and handles the repetitive maintenance work that slows down maintainers: labelling issues, chasing stale threads, welcoming new contributors, and enforcing pull request standards.
| Feature | Description |
|---|---|
| π·οΈ Auto-Labeler | Labels issues automatically based on keyword rules |
| π°οΈ Stale Issue Detector | Flags issues with no activity after a configurable number of days |
| π Welcome Bot | Posts a greeting comment on first-time contributor PRs |
| β PR Format Checker | Verifies PRs contain required sections before review |
| π Contributor Summary | Generates a ranked list of contributors by commit count |
- Prerequisites
- Installation
- Setting Up a GitHub Personal Access Token
- Configuration
- Usage
- Architecture
- Running Tests
- Contributing
- License
- Node.js v16 or higher
- npm v7 or higher
- A GitHub account with access to the repository you want to automate
Check your versions:
node --version
npm --version# 1. Clone the repository
git clone https://github.com/your-username/repo-pilot.git
cd repo-pilot
# 2. Install dependencies
npm install
# 3. Copy the environment template
cp .env.example .envRepoPilot needs a GitHub Personal Access Token (PAT) to authenticate API requests.
- Go to https://github.com/settings/tokens
- Click "Generate new token (classic)"
- Give it a descriptive name, e.g.
repopilot-local - Set an expiry date (90 days is a reasonable choice)
- Under Scopes, tick:
repoβ full repository access (read + write issues, PRs, labels)read:orgβ needed if your repository belongs to an organisation
- Click "Generate token" and copy the token immediately (it won't be shown again)
- Open your
.envfile and paste the token as the value ofGITHUB_TOKEN
β οΈ Never commit your.envfile or paste your token into source code. The.gitignorein this project already excludes.env.
Open the .env file you copied from .env.example and fill in your values:
# Required
GITHUB_TOKEN=ghp_yourTokenHere
GITHUB_OWNER=your-github-username
GITHUB_REPO=your-repository-name
# Stale bot β optional, defaults shown
STALE_DAYS=30
STALE_LABEL=stale
STALE_MESSAGE=This issue has been automatically marked as stale due to inactivity.
# Feature toggles
AUTO_LABEL_ENABLED=true
WELCOME_BOT_ENABLED=true
# PR checker β comma-separated required section headings
PR_REQUIRED_SECTIONS=## Description,## Testing,## ChecklistLabel rules are defined in src/config.js under config.labeler.rules. Each rule has a keywords array and a label string:
{ keywords: ['bug', 'error', 'crash'], label: 'bug' }To add or change rules, edit that array. (See Issue #9 if you'd like to make rules configurable via a JSON file without editing source code.)
npm start
# or
node examples/runAutomation.js# Label open issues by keyword
npm run label
# Find and mark stale issues
npm run stale
# Greet first-time contributors on open PRs
npm run welcomenode automation/labeler.js
node automation/staleIssueBot.js
node automation/welcomeBot.jsCreate .github/workflows/repopilot.yml in your repository:
name: RepoPilot
on:
schedule:
- cron: '0 6 * * *' # runs every day at 06:00 UTC
workflow_dispatch: # allows manual trigger from the Actions tab
jobs:
automate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm install
- run: npm start
env:
GITHUB_TOKEN: ${{ secrets.REPOPILOT_TOKEN }}
GITHUB_OWNER: ${{ github.repository_owner }}
GITHUB_REPO: ${{ github.event.repository.name }}Add your PAT as a repository secret named REPOPILOT_TOKEN in Settings β Secrets β Actions.
repo-pilot/
βββ src/
β βββ config.js # Reads .env and exports structured config
β βββ utils.js # Pure helpers: dates, strings, logger
β βββ githubClient.js # GitHub REST API transport layer (Axios)
β βββ issueManager.js # Issue automation logic
β βββ prManager.js # PR automation logic
β βββ automationEngine.js # Orchestrator β runs all tasks in sequence
β
βββ automation/ # Standalone runnable bot scripts
β βββ labeler.js
β βββ staleIssueBot.js
β βββ welcomeBot.js
β
βββ examples/
β βββ runAutomation.js # Main entry point
β
βββ tests/
βββ automation.test.js # Unit tests (pure functions only)
.env β config.js β automationEngine.js
βββ issueManager β githubClient β GitHub API
βββ prManager β githubClient β GitHub API
All HTTP calls are isolated in src/githubClient.js. Business rules live in issueManager.js and prManager.js. The engine in automationEngine.js calls those managers and reports results. This layered design means you can swap the HTTP client or mock the GitHub layer in tests without touching business logic.
npm testThe test suite exercises pure utility functions without making real API calls. See tests/automation.test.js for details.
The test suite is minimal by design. Adding comprehensive tests with Jest mocking is listed as Issue #10 β contributions welcome!
We welcome contributions of all sizes! Please read CONTRIBUTING.md for the full guide.
Quick start:
git checkout -b feat/your-feature
# make your changes
npm test
git commit -m "feat(scope): describe your change"
git push origin feat/your-feature
# open a Pull RequestBrowse issues.md for a list of 15 curated development tasks ranging from beginner-friendly (Trivial) to advanced (High).
MIT Β© RepoPilot Contributors