A comprehensive toolkit for rerunning failed GitHub Actions workflows on Pull Requests. Available in multiple implementations: Web App, TypeScript, Bash Script, and Interactive CLI.
# Web App (Best UX) ๐
npm run start:web
# Interactive CLI
npm run start:interactive
# Bash Script (Fast & Simple)
npm run start:gh
# TypeScript (Full-featured)
npm start:jssrc/
โโโ web/ # Modern Web Application
โ โโโ index.html # Web UI
โ โโโ app.ts # Frontend TypeScript
โ โโโ app.js # Compiled JavaScript
โ โโโ styles.css # Modern CSS with dark/light themes
โโโ index.ts # Original TypeScript implementation
โโโ index.test.ts # TypeScript tests
โโโ rerun-with-gh.sh # Bash script (GitHub CLI)
โโโ rerun-with-gh.test.sh # Bash script tests
โโโ interactive-cli.ts # Interactive CLI wrapper
โโโ interactive-cli.test.ts # Interactive CLI tests
npm installPrerequisites:
- Node.js 18+
- GitHub CLI (
gh) installed and authenticated:gh auth login(for CLI/Bash versions)
npm run start:webFeatures:
- โจ Modern responsive web interface
- ๐ Dark/Light theme support
- ๐ Searchable author selection with auto-complete
- ๐ Visual PR selection with approval status
- โก Real-time form validation
- ๐พ Configuration save/load from JSON files
- ๐ฏ Auto-loading of authors and PRs
- ๐ Detailed results display with proper contrast
Web Interface:
- Smart form validation with auto-focus on errors
- Searchable dropdown for active contributors (last 6 months)
- PR status display with emojis (โ approved, โณ pending)
- Auto-loading PRs when author is selected
- Configuration tips and file management
npm run rerunFeatures:
- โจ Beautiful interactive menus
- ๐ง Configuration wizard
- Automatic config saving
- ๐จ Colorized output
Interactive Menu:
๐ GitHub PR Workflow Rerun - Interactive CLI
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
? What would you like to do?
โฏ ๐ Rerun failed workflows for PR author
๐ฏ Rerun specific PR numbers
๐ List failed runs (no rerun)
โ๏ธ Configure settings
๐พ Save current configuration
โ Exit
# Use .env.gh configuration
npm run start:gh
# Or direct environment variables
AUTHOR=username DRY_RUN=false src/rerun-with-gh.shFeatures:
- ๐ Super fast execution
- ๐ฆ No dependencies (just
ghCLI) - ๐ง Environment file support
- ๐จ Colorized logging
npm startFeatures:
- ๐ Full GitHub API integration
- ๐ Detailed logging with Winston
- ๐งช Comprehensive test suite
- ๐ Table formatting
| Feature | Web App | Interactive CLI | Bash Script | TypeScript |
|---|---|---|---|---|
| User Experience | โญโญโญโญโญ | โญโญโญโญ | โญโญโญ | โญโญ |
| Visual Interface | โ Modern UI | โ Menus | โ Terminal | โ Terminal |
| Speed | โญโญโญโญ | โญโญโญ | โญโญโญโญโญ | โญโญโญ |
| Author Selection | โ Searchable | โ Interactive | โ Manual | โ Manual |
| PR Selection | โ Visual + Status | โ List | โ All/Manual | โ All/Manual |
| Configuration | โ Save/Load Files | โ Auto-save | โ .env files | โ Env vars only |
| Theme Support | โ Dark/Light | โ Terminal | โ Terminal | โ Terminal |
| Dependencies | Node.js + Browser | Node.js | gh CLI only | Node.js |
| Best For | Daily use | Setup/Config | Quick scripts | Development |
Recommendation: Use the Web App for the best experience, Bash Script for automation/scripts.
REPO_URL=https://github.com/owner/repo
AUTHOR=username
MODE=workflows
DRY_RUN=true
PR_NUMBERS=123,456AUTHOR=username MODE=jobs DRY_RUN=false npm run start:ghnpm run rerun
# Select "โ๏ธ Configure settings"| Variable | Description | Values | Default |
|---|---|---|---|
AUTHOR |
Filter PRs by author | GitHub username | - |
MODE |
Rerun mode | workflows, jobs |
workflows |
DRY_RUN |
Preview mode | true, false |
true |
REPO_URL |
Target repository | GitHub URL or owner/repo |
Current repo |
PR_NUMBERS |
Specific PRs | Comma-separated | All PRs |
workflows: Rerun entire workflow (all jobs)jobs: Rerun only failed jobs (faster)
# Run all tests
npm run test:all
# Individual test suites
npm run test # TypeScript tests
npm run test:gh # Bash script tests
npm run test:interactive # Interactive CLI testsTest Coverage:
- โ TypeScript: 9 tests (API integration, workflow logic)
- โ Bash Script: 10 tests (CLI functionality, config loading)
- โ Interactive CLI: 3 tests (module structure)
# Interactive
npm run rerun
# Select "๐ Rerun failed workflows for PR author"
# Bash
AUTHOR=myusername DRY_RUN=false npm run start:gh
# TypeScript
AUTHOR=myusername DRY_RUN=false npm start# Interactive
npm run rerun
# Select "๐ฏ Rerun specific PR numbers"
# Bash
PR_NUMBERS=123,456 DRY_RUN=false npm run start:gh
# Direct
npm run interactive -- --pr-numbers "123,456" --no-interactive# Interactive
npm run rerun
# Select "๐ List failed runs (no rerun)"
# Bash (dry run)
AUTHOR=username DRY_RUN=true npm run start:gh| Feature | Interactive CLI | Bash Script | TypeScript |
|---|---|---|---|
| UX | โญโญโญโญโญ | โญโญโญ | โญโญ |
| Speed | โญโญโญ | โญโญโญโญโญ | โญโญ |
| Features | โญโญโญโญโญ | โญโญโญโญ | โญโญโญโญโญ |
| Setup | โญโญโญ | โญโญโญโญโญ | โญโญ |
| Dependencies | โญโญโญ | โญโญโญโญโญ | โญโญ |
Recommendation:
- ๐ฏ New users: Interactive CLI
- โก Power users: Bash Script
- ๐ฌ Developers: TypeScript (for learning GitHub API)
# Install GitHub CLI
brew install gh
# Or visit: https://cli.github.com/
# Authenticate
gh auth loginchmod +x src/rerun-with-gh.sh
chmod +x src/rerun-with-gh.test.sh# Make sure you have access to the repository
gh repo view owner/repo
# Or specify explicitly
REPO_URL=https://github.com/owner/repo npm run start:gh- Run tests:
npm run test:all - Test all implementations:
- Interactive:
npm run rerun - Bash:
npm run start:gh - TypeScript:
npm start
- Interactive:
| Implementation | Startup Time | Memory | Dependencies |
|---|---|---|---|
| Bash Script | ~0.1s | ~5MB | gh only |
| Interactive CLI | ~1.5s | ~25MB | Node.js + packages |
| TypeScript | ~2s | ~30MB | Node.js + packages |
Three ways to rerun failed GitHub workflows:
- ๐ฎ Interactive CLI: Best user experience with guided menus
- โก Bash Script: Fastest execution with GitHub CLI
- ๐ TypeScript: Full-featured with comprehensive API integration
Choose based on your needs:
- Learning: TypeScript implementation
- Daily use: Interactive CLI
- Automation: Bash script
Happy workflow rerunning! ๐
processPR(): Main processing logic for individual PRs
The project uses Node.js built-in testing with ts-node for TypeScript support. Tests cover:
- URL parsing for different GitHub formats
- Configuration validation
- Status and conclusion filtering logic
- PR number parsing
- Mode enum validation
All functions are exported for testing while maintaining clean module execution.
- Reruns entire workflow runs that have failed
- Good for cases where the entire workflow needs to be restarted
- More comprehensive but uses more CI resources
- Reruns only the specific jobs that failed within workflows
- More targeted and efficient
- Preserves successful job results within the same workflow run
[21:21:59] info: Limiting to PR(s): 8212
[21:21:59] info: Working on repo: cardinalops/cardinalops
[21:21:59] info: Mode: RERUN FAILED JOBS
[21:21:59] info: Found 1 open PR(s) to process.
[21:21:59] info: PR #8212: fix: COPS-10604 - MITRE - Exposures - user should not be able to remove prevention products.. (author: nitzcard)
The codebase follows TypeScript best practices with:
- Enum-based configuration
- Proper error handling
- Comprehensive logging
- Modular function design
- Full test coverage