|
| 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