Skip to content

Commit 5dcaecc

Browse files
committed
Fixes workflow to properly commit 360 subfolder files
Changes the workflow to use full history checkout and explicit file additions to ensure files in the 360 subfolder are properly committed and pushed. This addresses the issue where files weren't being detected by Git due to the previous shallow clone approach. Adds a solution plan document to document the problem analysis, root cause, and implementation strategy for future reference.
1 parent e890faf commit 5dcaecc

2 files changed

Lines changed: 108 additions & 2 deletions

File tree

.github/workflows/merge-cvclaude-to-360.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
with:
2323
ref: main
2424
token: ${{ secrets.GITHUB_TOKEN }}
25-
clean: false
25+
fetch-depth: 0
2626

2727
- name: Checkout cvclaude branch
2828
uses: actions/checkout@v4
@@ -61,7 +61,17 @@ jobs:
6161
run: |
6262
git config --local user.email "action@github.com"
6363
git config --local user.name "GitHub Action"
64-
git add -A
64+
65+
# Add files explicitly with verification
66+
echo "Checking if 360/ files exist:"
67+
ls -la 360/
68+
69+
# Add files individually to ensure they're staged
70+
git add 360/index.html
71+
git add 360/index-fr.html
72+
git add 360/index-en.html
73+
git add 360/style.min.css
74+
6575
git status
6676
git commit -m "Update 360 subfolder with cvclaude branch content [skip ci]" || echo "No changes to commit"
6777
git push origin main

SOLUTION_PLAN.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Solution Plan for GitHub Actions Workflow Issue
2+
3+
## Problem Analysis
4+
5+
The workflow is failing because the GitHub Actions `checkout` step with `clean: false` is still deleting the repository contents when using `fetch-depth: 1`. This is a known limitation of the checkout action.
6+
7+
## Root Cause
8+
9+
- `checkout@v4` with `fetch-depth: 1` and any `clean` setting still initializes an empty repository
10+
- Files copied to `360/` directory are not detected by Git because the working directory is empty
11+
- `git add -A` has nothing to add because Git doesn't see the new files
12+
13+
## Solution Strategy
14+
15+
We need to use a different approach that doesn't rely on the checkout action preserving files. The working solution should:
16+
17+
1. **Use full history checkout** instead of shallow clone
18+
2. **Explicitly add files** using specific paths
19+
3. **Verify file existence** before commit operations
20+
21+
## Implementation Steps
22+
23+
### Step 1: Modify the Workflow
24+
25+
```yaml
26+
# In .github/workflows/merge-cvclaude-to-360.yml
27+
28+
- name: Checkout main branch
29+
uses: actions/checkout@v4
30+
with:
31+
ref: main
32+
token: ${{ secrets.GITHUB_TOKEN }}
33+
fetch-depth: 0 # Get full history instead of shallow clone
34+
35+
# ... rest of the workflow remains the same until commit step ...
36+
37+
- name: Commit and push changes to main
38+
run: |
39+
git config --local user.email "action@github.com"
40+
git config --local user.name "GitHub Action"
41+
42+
# Add files explicitly with verification
43+
echo "Checking if 360/ files exist:"
44+
ls -la 360/
45+
46+
# Add files individually to ensure they're staged
47+
git add 360/index.html
48+
git add 360/index-fr.html
49+
git add 360/index-en.html
50+
git add 360/style.min.css
51+
52+
git status
53+
git commit -m "Update 360 subfolder with cvclaude branch content [skip ci]" || echo "No changes to commit"
54+
git push origin main
55+
```
56+
57+
### Step 2: Alternative Approach (If above doesn't work)
58+
59+
If the full history checkout doesn't solve the issue, we can use a different strategy:
60+
61+
```yaml
62+
- name: Checkout main branch with full history
63+
uses: actions/checkout@v4
64+
with:
65+
ref: main
66+
token: ${{ secrets.GITHUB_TOKEN }}
67+
fetch-depth: 0
68+
69+
- name: Verify repository state
70+
run: |
71+
echo "Repository contents after checkout:"
72+
ls -la
73+
echo "Git status:"
74+
git status
75+
```
76+
77+
### Step 3: Debugging Steps
78+
79+
1. Add comprehensive logging to verify each step
80+
2. Check if the 360 directory exists in the main branch history
81+
3. Verify file permissions and ownership
82+
4. Test with explicit file additions
83+
84+
## Expected Outcome
85+
86+
After implementing this solution:
87+
- The workflow should detect the new files in the `360/` directory
88+
- `git add` should successfully stage the files
89+
- The commit should include the 4 built files
90+
- The push should update the main branch with cvclaude content in the 360 subfolder
91+
92+
## Verification
93+
94+
1. Check if `https://etiennelescot.github.io/cv/360/` becomes accessible
95+
2. Verify the content matches the cvclaude branch
96+
3. Confirm main branch content remains at root path

0 commit comments

Comments
 (0)