Skip to content

Commit bf1b0c9

Browse files
add actions files
1 parent 65ea3dc commit bf1b0c9

27 files changed

+4468
-0
lines changed

.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
GITHUB_TOKEN=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
2+
GITHUB_REPO=correasebastian/layers
3+
MAIN_BRANCH=main
4+
RELEASE_BRANCH=release

.gitignore copy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.env

DEPLOYMENT_GUIDE.md

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
# GitHub Branch Analyzer - Deployment Guide
2+
3+
This guide explains how to deploy the GitHub Branch Analyzer with date filtering to GitHub Pages using GitHub Actions.
4+
5+
## Overview
6+
7+
This deployment method will:
8+
1. Automatically run branch analysis on a schedule (daily by default)
9+
2. Generate visualizations for multiple dates
10+
3. Deploy the results to GitHub Pages
11+
4. Make the visualization accessible via a public URL
12+
13+
## Prerequisites
14+
15+
- A GitHub repository where you want to deploy the visualization
16+
- Admin access to the repository to configure GitHub Pages and secrets
17+
- A GitHub Personal Access Token (PAT) with appropriate permissions
18+
19+
## Step 1: Set Up Your Repository
20+
21+
1. Create a new repository or use an existing one
22+
2. Clone this repository to your local machine:
23+
```bash
24+
git clone https://github.com/yourusername/your-repository.git
25+
cd your-repository
26+
```
27+
28+
3. Copy all the files from the GitHub Branch Analyzer into your repository:
29+
- `.github/workflows/branch-analysis.yml`
30+
- `_config.yml`
31+
- `github_branch_analyzer_for_actions.py`
32+
- `analyze_branch_data_for_actions.py`
33+
- All files from the `git-branch-comparison-website` directory
34+
35+
## Step 2: Create a Personal Access Token
36+
37+
1. Go to GitHub → Settings → Developer settings → Personal access tokens → Fine-grained tokens
38+
2. Click "Generate new token"
39+
3. Give it a name like "Branch Analyzer Deployment"
40+
4. Set the expiration as needed (e.g., 1 year)
41+
5. Select the repository you want to analyze
42+
6. Under "Repository permissions", grant:
43+
- Contents: Read and write
44+
- Pull requests: Read
45+
- Metadata: Read
46+
- Pages: Read and write
47+
7. Click "Generate token" and copy the token value
48+
49+
## Step 3: Configure Repository Secrets
50+
51+
1. Go to your repository on GitHub
52+
2. Click on "Settings" → "Secrets and variables" → "Actions"
53+
3. Click "New repository secret"
54+
4. Add a secret with name `GH_PAT` and paste your Personal Access Token as the value
55+
5. Click "Add secret"
56+
57+
## Step 4: Configure GitHub Pages
58+
59+
1. Go to your repository on GitHub
60+
2. Click on "Settings" → "Pages"
61+
3. Under "Source", select "GitHub Actions" as the build and deployment source
62+
4. This will allow the workflow to handle the deployment
63+
64+
## Step 5: Customize the Workflow (Optional)
65+
66+
You can customize the workflow by editing `.github/workflows/branch-analysis.yml`:
67+
68+
1. Change the schedule:
69+
```yaml
70+
schedule:
71+
- cron: '0 0 * * *' # Default: Run daily at midnight
72+
```
73+
74+
2. Modify the branches to analyze:
75+
```yaml
76+
env:
77+
MAIN_BRANCH: main # Change to your main branch name
78+
RELEASE_BRANCH: release # Change to your release branch name
79+
```
80+
81+
3. Adjust the number of historical dates:
82+
```yaml
83+
# Run analysis for past 7 days
84+
for i in {1..7}; do # Change 7 to your desired number of days
85+
```
86+
87+
## Step 6: Push Changes and Trigger the Workflow
88+
89+
1. Commit and push all changes to your repository:
90+
```bash
91+
git add .
92+
git commit -m "Add GitHub Branch Analyzer with GitHub Actions deployment"
93+
git push
94+
```
95+
96+
2. This will automatically trigger the workflow for the first time
97+
98+
3. You can also manually trigger the workflow:
99+
- Go to your repository on GitHub
100+
- Click on "Actions"
101+
- Select the "Branch Comparison Analysis and Deployment" workflow
102+
- Click "Run workflow"
103+
104+
## Step 7: Access Your Deployed Visualization
105+
106+
1. After the workflow completes successfully:
107+
- Go to your repository on GitHub
108+
- Click on "Settings" → "Pages"
109+
- You'll see a message like "Your site is published at https://yourusername.github.io/your-repository/"
110+
111+
2. Visit the URL to access your branch comparison visualization
112+
113+
3. The visualization will be automatically updated according to your workflow schedule
114+
115+
## Troubleshooting
116+
117+
### Workflow Failures
118+
119+
If the workflow fails:
120+
1. Go to "Actions" in your repository
121+
2. Click on the failed workflow run
122+
3. Examine the logs to identify the issue
123+
124+
Common issues include:
125+
- Invalid Personal Access Token
126+
- Insufficient permissions
127+
- Repository not found
128+
- Branch names don't exist in your repository
129+
130+
### GitHub Pages Not Deploying
131+
132+
If GitHub Pages doesn't deploy:
133+
1. Verify that GitHub Pages is enabled for your repository
134+
2. Check that the workflow has the correct permissions
135+
3. Ensure the `gh-pages` branch was created by the workflow
136+
137+
### Visualization Not Showing Data
138+
139+
If the visualization loads but doesn't show data:
140+
1. Check that the analysis scripts ran successfully
141+
2. Verify that JSON files were generated and copied to the visualization directory
142+
3. Check browser console for JavaScript errors
143+
144+
## Advanced Configuration
145+
146+
### Custom Domain
147+
148+
To use a custom domain:
149+
1. Go to "Settings" → "Pages"
150+
2. Under "Custom domain", enter your domain
151+
3. Update DNS settings as instructed
152+
153+
### Additional Analysis Dates
154+
155+
To analyze more historical dates:
156+
1. Edit the workflow file
157+
2. Modify the loop that generates historical dates
158+
3. Consider performance implications for very large repositories
159+
160+
### Automatic Updates
161+
162+
The visualization will automatically update based on your workflow schedule. To change this:
163+
1. Edit the `schedule` section in the workflow file
164+
2. Use cron syntax to define your preferred schedule
165+
166+
## Conclusion
167+
168+
Your GitHub Branch Analyzer is now deployed to GitHub Pages and will automatically update according to your schedule. The visualization provides insights into your branch merging patterns over time, helping you understand your development workflow better.

README copy.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# GitHub Branch Analyzer with Date Filtering
2+
3+
A tool to compare branches in GitHub repositories at specific points in time, visualizing which feature branches were merged into main and release branches.
4+
5+
## Features
6+
7+
- **Date-Based Analysis**: Compare branches as they existed on any specific date
8+
- **Interactive Visualization**: See branch relationships through an interactive Venn diagram
9+
- **Timeline View**: Track how branches evolved over time with a visual timeline
10+
- **Branch Details**: Get detailed information about each merged branch
11+
- **Search & Filter**: Easily find specific branches across your repository
12+
- **History Navigation**: Jump between different analysis dates to see changes
13+
- **GitHub Pages Deployment**: Automatically deploy to GitHub Pages using GitHub Actions
14+
15+
## Repository Structure
16+
17+
```
18+
.
19+
├── .github/workflows/ # GitHub Actions workflow files
20+
│ └── branch-analysis.yml # Workflow for branch analysis and deployment
21+
├── _config.yml # GitHub Pages configuration
22+
├── github_branch_analyzer_for_actions.py # Script to analyze GitHub branches
23+
├── analyze_branch_data_for_actions.py # Script to process branch data
24+
├── visualization/ # Web visualization files (copied during deployment)
25+
├── DEPLOYMENT_GUIDE.md # Guide for deploying to GitHub Pages
26+
└── README.md # This file
27+
```
28+
29+
## Quick Start
30+
31+
1. **Fork or clone this repository**
32+
33+
2. **Create a GitHub Personal Access Token**
34+
- Go to GitHub → Settings → Developer settings → Personal access tokens
35+
- Create a token with `repo` permissions
36+
37+
3. **Add the token as a repository secret**
38+
- Go to your repository → Settings → Secrets → Actions
39+
- Add a secret named `GH_PAT` with your token as the value
40+
41+
4. **Configure GitHub Pages**
42+
- Go to your repository → Settings → Pages
43+
- Set source to "GitHub Actions"
44+
45+
5. **Trigger the workflow**
46+
- Go to Actions → "Branch Comparison Analysis and Deployment" → Run workflow
47+
48+
6. **Access your visualization**
49+
- Once the workflow completes, your visualization will be available at:
50+
- `https://[your-username].github.io/[repository-name]/`
51+
52+
## Configuration
53+
54+
You can customize the analysis by editing the workflow file:
55+
56+
- Change the branches to analyze (default: main and release)
57+
- Modify the analysis schedule (default: daily at midnight)
58+
- Adjust the number of historical dates to analyze
59+
60+
## Local Development
61+
62+
To run the analysis locally:
63+
64+
```bash
65+
# Install dependencies
66+
pip install PyGithub
67+
68+
# Run the analysis
69+
export GITHUB_TOKEN=your_token
70+
export GITHUB_REPO=owner/repo
71+
python github_branch_analyzer_for_actions.py
72+
python analyze_branch_data_for_actions.py
73+
```
74+
75+
## Documentation
76+
77+
For detailed deployment instructions, see [DEPLOYMENT_GUIDE.md](DEPLOYMENT_GUIDE.md).
78+
79+
## License
80+
81+
MIT
82+
83+
## Acknowledgements
84+
85+
This tool was created to help development teams better understand their branch merging patterns and improve their release processes.

0 commit comments

Comments
 (0)