mirror of
https://github.com/claude-did-this/claude-hub.git
synced 2026-02-14 19:30:02 +01:00
* feat: implement wait-for-all-checks PR review trigger This change modifies the PR review triggering logic to wait for ALL check suites to complete successfully before triggering a single PR review, preventing duplicate reviews from different check suites (build, security scans, etc.). Key changes: - Added PR_REVIEW_WAIT_FOR_ALL_CHECKS env var (default: true) - Added PR_REVIEW_DEBOUNCE_MS for configurable delay (default: 5000ms) - Implemented checkAllCheckSuitesComplete() function that queries GitHub API - Made PR_REVIEW_TRIGGER_WORKFLOW optional (only used when wait-for-all is false) - Updated tests to handle new behavior 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: correct indentation and remove test-results from git - Fix ESLint indentation errors in claudeService.js - Remove test-results directory from git tracking (added to .gitignore) 🤖 Generated with Claude Code (https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * feat: add Claude CLI database sharing and backup system - Mount host ~/.claude directory in container for shared context - Add .dockerignore to optimize build context - Create backup script with daily/weekly retention strategy - Add cron setup for automated backups to /backup partition 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: add missing makeGitHubRequest function to githubService The checkAllCheckSuitesComplete function was failing because it tried to call githubService.makeGitHubRequest which didn't exist. This was causing PR reviews to never trigger with the 'Waiting for other check suites to complete' message. Added the missing function to make direct GitHub API requests using Octokit. * fix: add URL validation to makeGitHubRequest to prevent SSRF vulnerability * refactor: remove makeGitHubRequest to fix SSRF vulnerability - Replace makeGitHubRequest with getCheckSuitesForRef using Octokit - Simplify getWorkflowNameFromCheckSuite to use app info from webhook - Fix tests to match new implementation - Add PR review environment variables to .env file --------- Co-authored-by: Jonathan Flatt <jonflatt@gmail.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: ClaudeBot <claude@example.com>
57 lines
1.8 KiB
Bash
Executable File
57 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
# Backup Claude CLI database to prevent corruption
|
|
|
|
# Use SUDO_USER if running with sudo, otherwise use current user
|
|
ACTUAL_USER="${SUDO_USER:-$USER}"
|
|
ACTUAL_HOME=$(eval echo ~$ACTUAL_USER)
|
|
|
|
CLAUDE_DIR="${ACTUAL_HOME}/.claude"
|
|
DB_FILE="${CLAUDE_DIR}/__store.db"
|
|
BACKUP_ROOT="/backup/claude-cli"
|
|
BACKUP_DIR="${BACKUP_ROOT}/daily"
|
|
WEEKLY_DIR="${BACKUP_ROOT}/weekly"
|
|
|
|
# Create backup directories if they don't exist (may need sudo)
|
|
if [ ! -d "${BACKUP_ROOT}" ]; then
|
|
if [ -w "/backup" ]; then
|
|
mkdir -p "${BACKUP_DIR}" "${WEEKLY_DIR}"
|
|
else
|
|
echo "Error: Cannot create backup directories in /backup"
|
|
echo "Please run: sudo mkdir -p ${BACKUP_DIR} ${WEEKLY_DIR}"
|
|
echo "Then run: sudo chown -R $USER:$USER ${BACKUP_ROOT}"
|
|
exit 1
|
|
fi
|
|
else
|
|
mkdir -p "${BACKUP_DIR}" "${WEEKLY_DIR}"
|
|
fi
|
|
|
|
# Generate timestamp for backup
|
|
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
|
|
DAY_OF_WEEK=$(date +%u) # 1=Monday, 6=Saturday
|
|
DATE_ONLY=$(date +%Y%m%d)
|
|
|
|
# Create backup if database exists
|
|
if [ -f "${DB_FILE}" ]; then
|
|
echo "Backing up Claude database..."
|
|
|
|
# Daily backup
|
|
DAILY_BACKUP="${BACKUP_DIR}/store_${TIMESTAMP}.db"
|
|
cp "${DB_FILE}" "${DAILY_BACKUP}"
|
|
echo "Daily backup created: ${DAILY_BACKUP}"
|
|
|
|
# Weekly backup on Saturdays
|
|
if [ "${DAY_OF_WEEK}" -eq "6" ]; then
|
|
WEEKLY_BACKUP="${WEEKLY_DIR}/store_saturday_${DATE_ONLY}.db"
|
|
cp "${DB_FILE}" "${WEEKLY_BACKUP}"
|
|
echo "Weekly Saturday backup created: ${WEEKLY_BACKUP}"
|
|
fi
|
|
|
|
# Clean up old daily backups (keep last 7 days)
|
|
find "${BACKUP_DIR}" -name "store_*.db" -type f -mtime +7 -delete
|
|
|
|
# Clean up old weekly backups (keep last 52 weeks)
|
|
find "${WEEKLY_DIR}" -name "store_saturday_*.db" -type f -mtime +364 -delete
|
|
|
|
else
|
|
echo "No Claude database found at ${DB_FILE}"
|
|
fi |