
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)
nvm use 20
npm install -g supersetbot
git clone https://github.com/apache-superset/supersetbot.git
cd supersetbot
nvm use 20
npm install
supersetbot [options] [command]
Global Options:
-v, --verbose Output extra debugging information
-r, --repo <repo> The GitHub repo to use (ie:"apache/superset")
-d, --dry-run Run the command in dry-run mode
-a, --actor <actor> The actor
-h, --help display help for command
Add a label to an issue or PR
supersetbot label "v3.0" -i 12345
supersetbot label "enhancement" -i 12345 -r apache/superset
Remove a label from an issue or PR
supersetbot unlabel "needs-review" -i 12345
Add organization label based on author
supersetbot orglabel -i 12345
Auto-label a PR with its release version
supersetbot release-label-pr 12345
supersetbot release-label-pr 12345 --exclude-cherries # Exclude cherry-picked commits
Batch label PRs for a specific release
supersetbot release-label v3.0.0
Auto-label multiple merged PRs
supersetbot release-label-prs --search "merged:>2024-01-01" --pages 5
Bump Python dependencies
# Update all dependencies
supersetbot bump-python
# Update specific package
supersetbot bump-python -p pandas
# Update a group of dependencies
supersetbot bump-python -g dev
# Create PRs with limits
supersetbot bump-python --limit 5 --only-base
Generate Docker build commands
# Build lean image
supersetbot docker --preset lean --platform linux/amd64
# Build for multiple platforms
supersetbot docker --preset dev --platform linux/amd64 linux/arm64
# Build and push
supersetbot docker --preset lean --push --context release --context-ref v3.0.0
Get version
supersetbot version
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.
supersetbot follows a modular architecture designed for extensibility and maintainability:
- 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
- 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 messages
# Run from source
./src/supersetbot [command]
# Run tests
npm test
# Lint code
npm run lint
GITHUB_TOKEN
: Required for GitHub API operationsGITHUB_REPOSITORY
: Default repository (e.g., "apache/superset")GITHUB_ACTOR
: The user performing the actionGITHUB_ISSUE_NUMBER
: Default issue/PR number for commands
supersetbot uses Jest with ES modules support:
# Run all tests
npm test
# Run specific test file
npm test src/utils.test.js
# Run with coverage
npm test -- --coverage
Test files follow the *.test.js
naming convention and are colocated with source files.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Make your changes
- Run tests and linting
- Commit your changes
- Push to your fork
- Open a Pull Request
- ES modules with
import
/export
syntax - ESLint with Airbnb configuration
- Async/await for asynchronous operations
- Commander.js for CLI structure
Licensed under the Apache License, Version 2.0. See the LICENSE file for details.