From c13dc992ca9706917cc959a1fb64111f0cf16b67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E4=BC=9F=E6=9D=B0?= <674416404@qq.com> Date: Wed, 7 Aug 2024 20:28:55 +0800 Subject: [PATCH 1/2] fix(pr-comment-ci): process completed with exit code 1 --- .github/workflows/pr-comment-ci.yml | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) 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" From 11954b35839550b1b580e2f797d626f8ed273828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E4=BC=9F=E6=9D=B0?= <674416404@qq.com> Date: Wed, 7 Aug 2024 20:52:04 +0800 Subject: [PATCH 2/2] fix(pr-comment-ci): process completed with exit code 1 --- .github/workflows/pr-comment-ci.yml | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pr-comment-ci.yml b/.github/workflows/pr-comment-ci.yml index a523c72e..5173cf36 100644 --- a/.github/workflows/pr-comment-ci.yml +++ b/.github/workflows/pr-comment-ci.yml @@ -107,27 +107,37 @@ jobs: common_conflict=$(git status | grep 'both modified:' | grep -c '_common') conflicts_sum=$((csr_snap_conflict + ssr_snap_conflict + common_conflict)) + echo "conflict_count: $conflict_count" + echo "working_tree_clean: $working_tree_clean" + echo "csr_snap_conflict: $csr_snap_conflict" + echo "ssr_snap_conflict: $ssr_snap_conflict" + echo "common_conflict: $common_conflict" + echo "conflicts_sum: $conflicts_sum" + if [ "$working_tree_clean" -eq "1" ]; then - echo "nothing to commit, working tree clean" - exit 0 + echo "nothing to commit, working tree clean" + exit 0 fi if [ "$conflict_count" -gt "0" ]&&[ "$conflicts_sum" -eq "0" ]; then - echo "Unknown conflict " - git status - exit 1 + echo "Unknown conflict " + git status + exit 1 fi if [ "$csr_snap_conflict" -eq "1" ];then - git checkout --theirs test/snap/__snapshots__/csr.test.jsx.snap + git checkout -f develop test/snap/__snapshots__/csr.test.jsx.snap + echo "resolve conflict csr.test.jsx.snap" fi if [ "$ssr_snap_conflict" -eq "1" ];then - git checkout --theirs test/snap/__snapshots__/ssr.test.jsx.snap + git checkout -f develop test/snap/__snapshots__/ssr.test.jsx.snap + echo "resolve conflict ssr.test.jsx.snap" fi if [ "$common_conflict" -eq "1" ];then - git checkout --theirs src/_common + git checkout -f develop src/_common + echo "resolve conflict _common" fi git commit -am "chore: merge develop"