Skip to content

Commit 401412a

Browse files
committed
Fix: Stash untracked files before checkout to workflow-artifact-data branch
1 parent 562e320 commit 401412a

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

.github/workflows/fetch-sfs-workflow.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,14 @@ jobs:
100100
# Check if branch exists remotely
101101
if git ls-remote --heads origin "$COMMIT_BRANCH" | grep -q "$COMMIT_BRANCH"; then
102102
echo "📥 Branch '$COMMIT_BRANCH' exists, checking out and merging with main..."
103-
# Branch exists - fetch and checkout
103+
# Branch exists - stash new untracked files to avoid checkout conflict
104104
git fetch origin "$COMMIT_BRANCH"
105+
git stash push --include-untracked -m "temp: new sfs files before branch switch"
105106
git checkout "$COMMIT_BRANCH"
106107
# Merge latest main into fixed branch to keep it updated
107108
git merge origin/main --no-edit --strategy-option theirs || echo "Merge completed (conflicts auto-resolved)"
109+
# Restore the newly generated files
110+
git stash pop
108111
else
109112
echo "🆕 Branch '$COMMIT_BRANCH' doesn't exist, creating new..."
110113
# Branch doesn't exist - create new

0 commit comments

Comments
 (0)