-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_with_date.sh
More file actions
70 lines (60 loc) · 2.45 KB
/
Copy pathrun_with_date.sh
File metadata and controls
70 lines (60 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# Run script for GitHub Branch Analyzer with date filtering
# This script runs the analyzer with the configured settings and date parameter
# Check if .env file exists and source it
if [ -f .env ]; then
source .env
else
echo "Error: .env file not found. Please run ./configure_with_date.sh first."
exit 1
fi
# Check if required variables are set
if [ -z "$GITHUB_TOKEN" ] || [ -z "$GITHUB_REPO" ]; then
echo "Error: GITHUB_TOKEN and GITHUB_REPO must be set in .env file."
echo "Please run ./configure_with_date.sh to configure these variables."
exit 1
fi
echo "Running GitHub Branch Analyzer for repository: $GITHUB_REPO"
echo "Comparing branches: $MAIN_BRANCH and $RELEASE_BRANCH"
# Determine output filename based on date
if [ -n "$ANALYSIS_DATE" ]; then
DATE_STR=$(echo $ANALYSIS_DATE | tr -d '-')
OUTPUT_FILE="branch_data_${DATE_STR}.json"
ANALYZED_OUTPUT_FILE="analyzed_branch_data_${DATE_STR}.json"
echo "Analysis date: $ANALYSIS_DATE"
echo "Output will be saved to: $OUTPUT_FILE"
else
OUTPUT_FILE="branch_data.json"
ANALYZED_OUTPUT_FILE="analyzed_branch_data.json"
echo "Analysis date: latest (no date filter)"
echo "Output will be saved to: $OUTPUT_FILE"
fi
# Run the Python script with date parameter if provided
if [ -n "$ANALYSIS_DATE" ]; then
python github_branch_analyzer_with_date.py --date "$ANALYSIS_DATE" --output "$OUTPUT_FILE"
else
python github_branch_analyzer_with_date.py --output "$OUTPUT_FILE"
fi
# Check if the analysis was successful
if [ $? -eq 0 ]; then
echo "Analysis completed successfully!"
echo "Results saved to $OUTPUT_FILE"
# Run the analysis script to add statistics
echo "Adding statistics to the data..."
python analyze_branch_data_with_date.py "$OUTPUT_FILE" "$ANALYZED_OUTPUT_FILE"
if [ $? -eq 0 ]; then
echo "Statistics added successfully!"
echo "Final results saved to $ANALYZED_OUTPUT_FILE"
# Copy the data to the visualization directory
if [ -d "../git-branch-comparison-website" ]; then
cp "$ANALYZED_OUTPUT_FILE" ../git-branch-comparison-website/
echo "Data copied to visualization website directory."
else
echo "Note: Visualization website directory not found."
fi
else
echo "Error: Failed to add statistics. Please check the error messages above."
fi
else
echo "Error: Analysis failed. Please check the error messages above."
fi