A bot for the Superset GitHub repo
npm install supersetbot
supersetbot is a utility bot that streamlines GitHub operations, CI/CD workflows, and release management for Apache Superset.
The bot can be used as a local CLI OR, for a subset of fitted use cases, can be invoked directly from GitHub comments using @supersetbot commands.
Because it's its own npm app, it can be tested/deployed/used in isolation from the rest of Superset, and take on some of the complexity from GitHub actions and onto a nifty utility that can be used in different contexts.
- Node.js 20 or higher
- npm or yarn
- Git
- GitHub personal access token (for GitHub operations)
bash
nvm use 20
npm install -g supersetbot
`$3
`bash
git clone https://github.com/apache-superset/supersetbot.git
cd supersetbot
nvm use 20
npm install
`Features
$3
`bash
supersetbot [options] [command]Global Options:
-v, --verbose Output extra debugging information
-r, --repo The GitHub repo to use (ie:"apache/superset")
-d, --dry-run Run the command in dry-run mode
-a, --actor The actor
-h, --help display help for command
`#### Label Management
Add a label to an issue or PR
`bash
supersetbot label "v3.0" -i 12345
supersetbot label "enhancement" -i 12345 -r apache/superset
`Remove a label from an issue or PR
`bash
supersetbot unlabel "needs-review" -i 12345
`Add organization label based on author
`bash
supersetbot orglabel -i 12345
`#### Release Management
Auto-label a PR with its release version
`bash
supersetbot release-label-pr 12345
supersetbot release-label-pr 12345 --exclude-cherries # Exclude cherry-picked commits
`Batch label PRs for a specific release
`bash
supersetbot release-label v3.0.0
`Auto-label multiple merged PRs
`bash
supersetbot release-label-prs --search "merged:>2024-01-01" --pages 5
`#### Python Dependencies
Bump Python dependencies
`bash
Update all dependencies
supersetbot bump-pythonUpdate specific package
supersetbot bump-python -p pandasUpdate a group of dependencies
supersetbot bump-python -g devCreate PRs with limits
supersetbot bump-python --limit 5 --only-base
`#### Docker Operations
Generate Docker build commands
`bash
Build lean image
supersetbot docker --preset lean --platform linux/amd64Build for multiple platforms
supersetbot docker --preset dev --platform linux/amd64 linux/arm64Build and push
supersetbot docker --preset lean --push --context release --context-ref v3.0.0
`#### Utility Commands
Get version
`bash
supersetbot version
`GitHub Integration
supersetbot can be invoked directly from GitHub comments in issues and PRs:
`
@supersetbot label v3.0
@supersetbot orglabel
@supersetbot release-label-pr 12345
`The bot will process the command and respond with a comment containing the results.
Architecture
supersetbot follows a modular architecture designed for extensibility and maintainability:
$3
- CLI Interface (
src/cli.js): Commander.js-based CLI that defines all available commands
- Context Manager (src/context.js): Handles execution context (CLI vs GitHub Actions) and manages logging
- GitHub Client (src/github.js): Octokit-based GitHub API wrapper with rate limiting and throttling
- Git Operations (src/git.js): Release management and PR analysis using simple-git
- Docker Builder (src/docker.js): Docker command generation for various build presets
- Utilities (src/utils.js): Shared helper functions and shell command execution$3
- Context-Aware Execution: Commands behave differently based on execution environment
- Dry-Run Support: All destructive operations support
--dry-run for safety
- Verbose Logging: Detailed debug output available with --verbose flag
- Error Resilience: Graceful error handling with informative messagesDevelopment
$3
`bash
Run from source
./src/supersetbot [command]Run tests
npm testLint code
npm run lint
`$3
-
GITHUB_TOKEN: Required for GitHub API operations
- GITHUB_REPOSITORY: Default repository (e.g., "apache/superset")
- GITHUB_ACTOR: The user performing the action
- GITHUB_ISSUE_NUMBER: Default issue/PR number for commands$3
supersetbot uses Jest with ES modules support:
`bash
Run all tests
npm testRun specific test file
npm test src/utils.test.jsRun with coverage
npm test -- --coverage
`Test files follow the
*.test.js naming convention and are colocated with source files.Contributing
1. Fork the repository
2. Create a feature branch (
git checkout -b feature/amazing-feature)
3. Make your changes
4. Run tests and linting
5. Commit your changes
6. Push to your fork
7. Open a Pull Request$3
- ES modules with
import/export` syntaxLicensed under the Apache License, Version 2.0. See the LICENSE file for details.