Skip to content

Commit

Permalink
fix(pr-comment-ci): process completed with exit code 1
Browse files Browse the repository at this point in the history
  • Loading branch information
liweijie0812 committed Aug 7, 2024
1 parent fcd05b7 commit c13dc99
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions .github/workflows/pr-comment-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,31 +100,34 @@ jobs:
git merge develop --no-commit || true
- name: check conflicts
run: |
count_both_modified=$(git status | grep -c 'both modified:')
conflict_count=$(git status | grep -c 'both modified:')
working_tree_clean=$(git status | grep -c 'nothing to commit, working tree clean')
both_modified_csr_snap=$(git status | grep 'both modified:' | grep -c 'csr.test.jsx.snap')
both_modified_ssr_snap=$(git status | grep 'both modified:' | grep -c 'ssr.test.jsx.snap')
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')
conflicts_sum=$((csr_snap_conflict + ssr_snap_conflict + common_conflict))
if [ "$working_tree_clean" -eq "1" ]; then
echo "nothing to commit, working tree clean"
return 0
exit 0
fi
if [ "$count_both_modified" -gt "0" ]&&[ "$both_modified_csr_snap" -eq "0" ]&&[ "$both_modified_ssr_snap" -eq "0" ]; then
if [ "$conflict_count" -gt "0" ]&&[ "$conflicts_sum" -eq "0" ]; then
echo "Unknown conflict "
git status
exit 1
fi
if [ "$count_both_modified" -gt "0" ]&&[ "$count_both_modified" -lt "3" ]; then
if [ "$both_modified_csr_snap" -eq "1" ];then
if [ "$csr_snap_conflict" -eq "1" ];then
git checkout --theirs test/snap/__snapshots__/csr.test.jsx.snap
fi
if [ "$both_modified_ssr_snap" -eq "1" ];then
fi
if [ "$ssr_snap_conflict" -eq "1" ];then
git checkout --theirs test/snap/__snapshots__/ssr.test.jsx.snap
fi
git commit -am "chore: merge develop fix snap conflict"
return 0
fi
if [ "$common_conflict" -eq "1" ];then
git checkout --theirs src/_common
fi
git commit -am "chore: merge develop"
Expand Down

0 comments on commit c13dc99

Please sign in to comment.