Skip to content

Commit

Permalink
fix: pr-comment-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
liweijie0812 committed Aug 8, 2024
1 parent 59a0452 commit 5f06010
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions .github/workflows/pr-comment-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,12 @@ jobs:
git merge develop --no-commit || true
- name: check conflicts
run: |
conflict_count=$(git status | grep -c 'both modified:')
working_tree_clean=$(git status | grep -c 'nothing to commit, working tree clean')
csr_snap_conflict=$(git status | grep 'both modified:' | grep -c 'csr.test.jsx.snap')
ssr_snap_conflict=$(git status | grep 'both modified:' | grep -c 'ssr.test.jsx.snap')
common_conflict=$(git status | grep 'both modified:' | grep -c '_common')
git status
conflict_count=$(git status | grep -c 'both modified:') || true
working_tree_clean=$(git status | grep -c 'nothing to commit, working tree clean') || true
csr_snap_conflict=$(git status | grep 'both modified:' | grep -c 'csr.test.jsx.snap') || true
ssr_snap_conflict=$(git status | grep 'both modified:' | grep -c 'ssr.test.jsx.snap') || true
common_conflict=$(git status | grep 'both modified:' | grep -c '_common') || true
conflicts_sum=$((csr_snap_conflict + ssr_snap_conflict + common_conflict))
echo "conflict_count: $conflict_count"
echo "working_tree_clean: $working_tree_clean"
Expand All @@ -125,20 +126,24 @@ jobs:
fi
if [ "$csr_snap_conflict" -eq "1" ];then
git checkout -f develop test/snap/__snapshots__/csr.test.jsx.snap
git checkout --theirs test/snap/__snapshots__/csr.test.jsx.snap
git add test/snap/__snapshots__/csr.test.jsx.snap
echo "resolve conflict csr.test.jsx.snap"
fi
if [ "$ssr_snap_conflict" -eq "1" ];then
git checkout -f develop test/snap/__snapshots__/ssr.test.jsx.snap
git checkout --theirs test/snap/__snapshots__/ssr.test.jsx.snap
git add test/snap/__snapshots__/ssr.test.jsx.snap
echo "resolve conflict ssr.test.jsx.snap"
fi
if [ "$common_conflict" -eq "1" ];then
git checkout -f develop src/_common
git checkout --theirs src/_common
git add src/_common
echo "resolve conflict _common"
fi
git status
git commit -am "chore: merge develop"
- uses: actions/setup-node@v4
Expand All @@ -148,14 +153,14 @@ jobs:
- run: npm run test:update
- name: Commit Snapshot
run: |
working_tree_clean=$(git status | grep -c 'nothing to commit, working tree clean')
working_tree_clean=$(git status | grep -c 'nothing to commit, working tree clean') || true
if [ "$working_tree_clean" -eq "0" ]; then
git add .
git commit -m "chore: update snapshot"
fi
- name: git push
run: |
branch_ahead=$(git status | grep -c 'Your branch is ahead of')
branch_ahead=$(git status | grep -c 'Your branch is ahead of') || true
if [ "$branch_ahead" -eq "1" ]; then
git push
fi

0 comments on commit 5f06010

Please sign in to comment.