Skip to content

Commit 7ddcf9e

Browse files
committed
improve pushing to gh-pages
1 parent 2477b97 commit 7ddcf9e

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

.github/workflows/run_scrna_qc.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,27 @@ jobs:
6666
run: |
6767
git config --global user.name "github-actions[bot]"
6868
git config --global user.email "github-actions[bot]@users.noreply.github.com"
69-
git fetch origin gh-pages || git checkout --orphan gh-pages
70-
git switch gh-pages || git checkout -b gh-pages
69+
# Fetch gh-pages branch (create if missing)
70+
OUTPUT_FILE="01_quality_assessment/scRNA_QC.html"
71+
72+
git fetch origin gh-pages || true
73+
if git show-ref --verify --quiet refs/remotes/origin/gh-pages; then
74+
git checkout gh-pages
75+
git merge --strategy=ours origin/gh-pages
76+
else
77+
git checkout --orphan gh-pages
78+
fi
79+
80+
# Copy the HTML file into place (keep existing files)
81+
mkdir -p 01_quality_assessment
82+
cp "$OUTPUT_FILE" 01_quality_assessment/
83+
84+
# Commit only if changes exist
7185
git add 01_quality_assessment/scRNA_QC.html
72-
git commit -m "Deploy scRNA_QC.html [skip ci]" || echo "No changes to commit"
73-
git push origin gh-pages
86+
if git diff --cached --quiet; then
87+
echo "No changes to commit"
88+
else
89+
git commit -m "Deploy scRNA_QC.html [skip ci]"
90+
git push origin gh-pages
91+
fi
7492
shell: bash

0 commit comments

Comments
 (0)