fix(ci): Use git stash to preserve artifacts before checking out main

Fixed perf-aggregate-report job failure caused by artifact files
conflicting with git checkout.

The issue:
- Job downloads artifacts from perf-report (reports/4.2.5/*)
- Tries to checkout main with 'git checkout -B main origin/main'
- Fails because artifact files would be overwritten

The solution:
1. Stash all artifact files and generated content
2. Checkout main branch cleanly
3. Pull latest changes from origin/main
4. Pop stash to restore artifacts
5. Add and commit aggregated report

This preserves the artifact files while properly syncing with remote main.
This commit is contained in:
russell@unturf.com 2026-01-19 14:15:18 -05:00
parent 106e2014d5
commit 824a555974

View file

@ -334,8 +334,14 @@ perf-aggregate-report:
- git config user.email "ci@unturf.com"
- git config user.name "GitLab CI"
- git fetch origin main
- git checkout -B main origin/main
- echo "Step 6 - Committing aggregated report..."
- echo "Step 6 - Stashing artifact files temporarily..."
- git add -A
- git stash push -m "Temporary stash of artifacts and generated files"
- echo "Step 7 - Checking out main branch..."
- git checkout main
- git pull origin main || echo "Already up to date"
- echo "Step 8 - Restoring artifacts and committing..."
- git stash pop || echo "No stash to pop"
- git add reports/ AGGREGATED-PERFORMANCE.md
- |
if git diff --cached --quiet; then
@ -344,6 +350,7 @@ perf-aggregate-report:
git commit -m "perf: Update aggregated performance analysis [ci skip]"
fi
- git push origin main || echo "Nothing to push"
- echo "Step 9 - Verifying results..."
- echo "✓ Aggregated report generated with charts"
- ls -lh AGGREGATED-PERFORMANCE.md
- ls -lh reports/aggregated-*.png 2>/dev/null || echo " (charts may not have generated)"