diff --git a/.github/workflows/pr-comment-ci.yml b/.github/workflows/pr-comment-ci.yml index bd25e939..a523c72e 100644 --- a/.github/workflows/pr-comment-ci.yml +++ b/.github/workflows/pr-comment-ci.yml @@ -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"