Skip to content

Commit c06fe70

Browse files
justin808claude
andcommitted
Add --help flag to CI debugging scripts
Both bin/ci-rerun-failures and bin/ci-run-failed-specs now support --help/-h flags that display: - Usage instructions - Available options - Examples - Features - Related tools Makes the scripts more discoverable and easier to use for contributors. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 02df4f3 commit c06fe70

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed

bin/ci-rerun-failures

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,48 @@ YELLOW='\033[1;33m'
1515
BLUE='\033[0;34m'
1616
NC='\033[0m' # No Color
1717

18+
# Show help
19+
show_help() {
20+
cat << EOF
21+
${BLUE}CI Failure Re-runner${NC}
22+
23+
Automatically detects failed CI jobs from GitHub and re-runs them locally.
24+
25+
${YELLOW}Usage:${NC}
26+
bin/ci-rerun-failures [OPTIONS] [PR_NUMBER]
27+
28+
${YELLOW}Options:${NC}
29+
--previous, --prev, -p Search recent commits for failures (when current is clean)
30+
--help, -h Show this help message
31+
32+
${YELLOW}Examples:${NC}
33+
bin/ci-rerun-failures # Check current commit
34+
bin/ci-rerun-failures --previous # Find failures in recent commits
35+
bin/ci-rerun-failures 1964 # Check specific PR number
36+
37+
${YELLOW}Features:${NC}
38+
- Fetches actual CI failures from GitHub using gh CLI
39+
- Waits for in-progress CI jobs (polls every 30s)
40+
- Maps CI job names to local rake commands
41+
- Deduplicates commands
42+
- Shows what will run before executing
43+
44+
${YELLOW}Related Tools:${NC}
45+
bin/ci-run-failed-specs Run specific failing RSpec examples
46+
bin/ci-local Smart test detection based on code changes
47+
EOF
48+
exit 0
49+
}
50+
1851
# Parse arguments
1952
USE_PREVIOUS=false
2053
PR_NUMBER=""
2154

2255
while [[ $# -gt 0 ]]; do
2356
case $1 in
57+
--help|-h)
58+
show_help
59+
;;
2460
--previous|--prev|-p)
2561
USE_PREVIOUS=true
2662
shift

bin/ci-run-failed-specs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,62 @@ YELLOW='\033[1;33m'
1818
BLUE='\033[0;34m'
1919
NC='\033[0m' # No Color
2020

21+
# Show help
22+
show_help() {
23+
cat << EOF
24+
${BLUE}Failed Spec Runner${NC}
25+
26+
Run only the specific RSpec examples that failed in CI.
27+
28+
${YELLOW}Usage:${NC}
29+
bin/ci-run-failed-specs [OPTIONS] [SPEC_PATHS...]
30+
pbpaste | bin/ci-run-failed-specs
31+
bin/ci-run-failed-specs < failures.txt
32+
33+
${YELLOW}Options:${NC}
34+
--help, -h Show this help message
35+
36+
${YELLOW}Examples:${NC}
37+
# Pass spec paths directly
38+
bin/ci-run-failed-specs './spec/system/integration_spec.rb[1:1:1:1]'
39+
40+
# Copy from GitHub Actions, paste to run
41+
pbpaste | bin/ci-run-failed-specs
42+
43+
# From file
44+
bin/ci-run-failed-specs < failures.txt
45+
46+
# Multiple specs
47+
bin/ci-run-failed-specs './spec/system/integration_spec.rb[1:1:1:1]' './spec/system/integration_spec.rb[10:1]'
48+
49+
${YELLOW}Features:${NC}
50+
- Parses RSpec failure output automatically
51+
- Extracts spec paths from "rspec ./spec/..." lines
52+
- Deduplicates specs
53+
- Auto-detects working directory (runs from spec/dummy when needed)
54+
- Confirms before running
55+
56+
${YELLOW}Workflow:${NC}
57+
1. Go to failed job on GitHub Actions
58+
2. Copy the "Failed examples:" section
59+
3. Run: pbpaste | bin/ci-run-failed-specs
60+
4. Tests run only for those specific failures
61+
62+
${YELLOW}Related Tools:${NC}
63+
bin/ci-rerun-failures Auto-detect and re-run failed CI jobs
64+
bin/ci-local Smart test detection based on code changes
65+
EOF
66+
exit 0
67+
}
68+
2169
echo -e "${BLUE}=== Failed Spec Runner ===${NC}"
2270
echo ""
2371

72+
# Check for help flag
73+
if [[ "${1:-}" == "--help" ]] || [[ "${1:-}" == "-h" ]]; then
74+
show_help
75+
fi
76+
2477
# Collect spec paths
2578
SPECS=()
2679

0 commit comments

Comments
 (0)