From d906e55e97e7bebc6e1743eed22df9c34cdf8ead Mon Sep 17 00:00:00 2001 From: s2mr Date: Wed, 15 Feb 2023 11:08:28 +0900 Subject: [PATCH 01/17] empty From 88205485086019d9af96697933e593df964bc717 Mon Sep 17 00:00:00 2001 From: s2mr Date: Wed, 15 Feb 2023 11:15:13 +0900 Subject: [PATCH 02/17] Fix --- Scripts/my-script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/my-script.sh b/Scripts/my-script.sh index f1a9100..179e8be 100755 --- a/Scripts/my-script.sh +++ b/Scripts/my-script.sh @@ -11,7 +11,7 @@ if [ "$TARGET_BRANCH" != "" ] then git pull git checkout "$TARGET_BRANCH" - git merge origin/"$PR_BRANCH" --no-rebase -m "[ota] Merge branch '$PR_BRANCH' into $TARGET_BRANCH" + git merge origin/"$PR_BRANCH" -m "[ota] Merge branch '$PR_BRANCH' into $TARGET_BRANCH" else git commit --allow-empty -m "[ota]${COMMENT_BODY##/ota}" fi From ab1a63de03782f2a610163bd2181ab2ea751e96b Mon Sep 17 00:00:00 2001 From: s2mr Date: Wed, 15 Feb 2023 11:17:11 +0900 Subject: [PATCH 03/17] empty commit! From 89d25159f8500ca2741b0efaa0ac761b142f64ae Mon Sep 17 00:00:00 2001 From: s2mr Date: Wed, 15 Feb 2023 11:18:55 +0900 Subject: [PATCH 04/17] Add line break --- Scripts/my-script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/my-script.sh b/Scripts/my-script.sh index 179e8be..81eaf7c 100755 --- a/Scripts/my-script.sh +++ b/Scripts/my-script.sh @@ -16,4 +16,4 @@ else git commit --allow-empty -m "[ota]${COMMENT_BODY##/ota}" fi -git push \ No newline at end of file +git push From 139bf211b4acc7edd877eb4b30cfe74f592c94cb Mon Sep 17 00:00:00 2001 From: s2mr Date: Wed, 15 Feb 2023 11:24:27 +0900 Subject: [PATCH 05/17] Fix --- Scripts/my-script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/my-script.sh b/Scripts/my-script.sh index 81eaf7c..1d85579 100755 --- a/Scripts/my-script.sh +++ b/Scripts/my-script.sh @@ -11,7 +11,7 @@ if [ "$TARGET_BRANCH" != "" ] then git pull git checkout "$TARGET_BRANCH" - git merge origin/"$PR_BRANCH" -m "[ota] Merge branch '$PR_BRANCH' into $TARGET_BRANCH" + git merge origin/"$PR_BRANCH" --no-ff -m "[ota] Merge branch '$PR_BRANCH' into $TARGET_BRANCH" else git commit --allow-empty -m "[ota]${COMMENT_BODY##/ota}" fi From 0e1af138cb9f89c4d675bdc017abfac6c9a9e542 Mon Sep 17 00:00:00 2001 From: s2mr Date: Wed, 15 Feb 2023 11:26:47 +0900 Subject: [PATCH 06/17] Fix scripts --- Scripts/my-script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Scripts/my-script.sh b/Scripts/my-script.sh index 1d85579..dbaeae9 100755 --- a/Scripts/my-script.sh +++ b/Scripts/my-script.sh @@ -2,7 +2,7 @@ set -eu -git config user.name s2mr +git config user.name Kazumasa Shimomura git config user.email s2mr@users.noreply.github.com TARGET_BRANCH=$(echo "$COMMENT_BODY" | sed -e 's/\/ota --with \(.*\).*/\1/g') @@ -11,7 +11,7 @@ if [ "$TARGET_BRANCH" != "" ] then git pull git checkout "$TARGET_BRANCH" - git merge origin/"$PR_BRANCH" --no-ff -m "[ota] Merge branch '$PR_BRANCH' into $TARGET_BRANCH" + git merge origin/"$PR_BRANCH" --no-ff # -m "[ota] Merge branch '$PR_BRANCH' into $TARGET_BRANCH" else git commit --allow-empty -m "[ota]${COMMENT_BODY##/ota}" fi From 911e133bfc14f0b153feab48ed89b6b504f8343c Mon Sep 17 00:00:00 2001 From: s2mr Date: Thu, 16 Feb 2023 00:03:33 +0900 Subject: [PATCH 07/17] Fix --- Scripts/my-script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/my-script.sh b/Scripts/my-script.sh index a50f710..a42fe12 100755 --- a/Scripts/my-script.sh +++ b/Scripts/my-script.sh @@ -11,7 +11,7 @@ if [ "$TARGET_BRANCH" != "" ]; then git pull git checkout "$TARGET_BRANCH" - git mmmmerge origin/"$PR_BRANCH" --no-ff 2> /tmp/Error + git merge origin/"$PR_BRANCH" --no-ff 2> /tmp/Error if [ "$(cat /tmp/Error)" != "" ]; then echo "error=$(cat /tmp/Error)" >> "$GITHUB_OUTPUT" From a947792746952c2e9e180d73477844f68df0739f Mon Sep 17 00:00:00 2001 From: s2mr Date: Thu, 16 Feb 2023 00:11:22 +0900 Subject: [PATCH 08/17] Fix --- Scripts/my-script.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Scripts/my-script.sh b/Scripts/my-script.sh index a42fe12..6daa1c6 100755 --- a/Scripts/my-script.sh +++ b/Scripts/my-script.sh @@ -2,23 +2,24 @@ set -u +function error_handler() { + echo "error=$(cat /tmp/Error)" >> "$GITHUB_OUTPUT" + exit 1 +} + +trap error_handler ERR + git config user.name 'Kazumasa Shimomura' git config user.email s2mr@users.noreply.github.com TARGET_BRANCH=$(echo "$COMMENT_BODY" | sed -e 's/\/ota --into \(.*\).*/\1/g') if [ "$TARGET_BRANCH" != "" ]; then - git pull - git checkout "$TARGET_BRANCH" - + git pull 2> /tmp/Error + git checkout "$TARGET_BRANCH" 2> /tmp/Error git merge origin/"$PR_BRANCH" --no-ff 2> /tmp/Error - - if [ "$(cat /tmp/Error)" != "" ]; then - echo "error=$(cat /tmp/Error)" >> "$GITHUB_OUTPUT" - exit 1 - fi else - git commit --allow-empty -m "[ota]${COMMENT_BODY##/ota}" + git commit --allow-empty -m "[ota]${COMMENT_BODY##/ota}" 2> /tmp/Error fi git push From 46175d073274e09d0dfd596246c3ffc9f4981b02 Mon Sep 17 00:00:00 2001 From: s2mr Date: Thu, 16 Feb 2023 00:44:03 +0900 Subject: [PATCH 09/17] Fix --- Scripts/my-script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/my-script.sh b/Scripts/my-script.sh index 6daa1c6..4278b6d 100755 --- a/Scripts/my-script.sh +++ b/Scripts/my-script.sh @@ -12,7 +12,7 @@ trap error_handler ERR git config user.name 'Kazumasa Shimomura' git config user.email s2mr@users.noreply.github.com -TARGET_BRANCH=$(echo "$COMMENT_BODY" | sed -e 's/\/ota --into \(.*\).*/\1/g') +TARGET_BRANCH=$(echo "$COMMENT_BODY" | sed 's/.*--into *\([^ ]*\).*/\1/') if [ "$TARGET_BRANCH" != "" ]; then git pull 2> /tmp/Error From d632046afb85e2877c3853068dc9bceccff51f72 Mon Sep 17 00:00:00 2001 From: s2mr Date: Thu, 16 Feb 2023 00:54:38 +0900 Subject: [PATCH 10/17] Fix --- Scripts/my-script.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Scripts/my-script.sh b/Scripts/my-script.sh index 4278b6d..60ece4e 100755 --- a/Scripts/my-script.sh +++ b/Scripts/my-script.sh @@ -13,11 +13,12 @@ git config user.name 'Kazumasa Shimomura' git config user.email s2mr@users.noreply.github.com TARGET_BRANCH=$(echo "$COMMENT_BODY" | sed 's/.*--into *\([^ ]*\).*/\1/') +EXTRA_MESSAGE=$(sed 's/.*--into [^ ]* *\(.*\)/\1/') if [ "$TARGET_BRANCH" != "" ]; then git pull 2> /tmp/Error git checkout "$TARGET_BRANCH" 2> /tmp/Error - git merge origin/"$PR_BRANCH" --no-ff 2> /tmp/Error + git merge origin/"$PR_BRANCH" --no-ff --log -m "$EXTRA_MESSAGE" 2> /tmp/Error else git commit --allow-empty -m "[ota]${COMMENT_BODY##/ota}" 2> /tmp/Error fi From b4974203b9ed68c0446ff9ac625dd5e772c9ac5c Mon Sep 17 00:00:00 2001 From: s2mr Date: Thu, 16 Feb 2023 00:56:20 +0900 Subject: [PATCH 11/17] Fix --- Scripts/my-script.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Scripts/my-script.sh b/Scripts/my-script.sh index 60ece4e..4278b6d 100755 --- a/Scripts/my-script.sh +++ b/Scripts/my-script.sh @@ -13,12 +13,11 @@ git config user.name 'Kazumasa Shimomura' git config user.email s2mr@users.noreply.github.com TARGET_BRANCH=$(echo "$COMMENT_BODY" | sed 's/.*--into *\([^ ]*\).*/\1/') -EXTRA_MESSAGE=$(sed 's/.*--into [^ ]* *\(.*\)/\1/') if [ "$TARGET_BRANCH" != "" ]; then git pull 2> /tmp/Error git checkout "$TARGET_BRANCH" 2> /tmp/Error - git merge origin/"$PR_BRANCH" --no-ff --log -m "$EXTRA_MESSAGE" 2> /tmp/Error + git merge origin/"$PR_BRANCH" --no-ff 2> /tmp/Error else git commit --allow-empty -m "[ota]${COMMENT_BODY##/ota}" 2> /tmp/Error fi From 6d534998cc86f6936fdae8574ba0d6f5b2384658 Mon Sep 17 00:00:00 2001 From: s2mr Date: Thu, 16 Feb 2023 01:13:48 +0900 Subject: [PATCH 12/17] Fix --- Scripts/my-script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/my-script.sh b/Scripts/my-script.sh index 4278b6d..0654906 100755 --- a/Scripts/my-script.sh +++ b/Scripts/my-script.sh @@ -17,7 +17,7 @@ TARGET_BRANCH=$(echo "$COMMENT_BODY" | sed 's/.*--into *\([^ ]*\).*/\1/') if [ "$TARGET_BRANCH" != "" ]; then git pull 2> /tmp/Error git checkout "$TARGET_BRANCH" 2> /tmp/Error - git merge origin/"$PR_BRANCH" --no-ff 2> /tmp/Error + git merge origin/"$PR_BRANCH" --no-ff -m "Merge remote-tracking branch 'origin/$PR_BRANCH' into $TARGET_BRANCH" 2> /tmp/Error else git commit --allow-empty -m "[ota]${COMMENT_BODY##/ota}" 2> /tmp/Error fi From f8416754f60344fb80a4819da510a0a3009a5b1c Mon Sep 17 00:00:00 2001 From: s2mr Date: Thu, 16 Feb 2023 01:16:22 +0900 Subject: [PATCH 13/17] Fix --- Scripts/my-script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/my-script.sh b/Scripts/my-script.sh index 0654906..af44857 100755 --- a/Scripts/my-script.sh +++ b/Scripts/my-script.sh @@ -17,7 +17,7 @@ TARGET_BRANCH=$(echo "$COMMENT_BODY" | sed 's/.*--into *\([^ ]*\).*/\1/') if [ "$TARGET_BRANCH" != "" ]; then git pull 2> /tmp/Error git checkout "$TARGET_BRANCH" 2> /tmp/Error - git merge origin/"$PR_BRANCH" --no-ff -m "Merge remote-tracking branch 'origin/$PR_BRANCH' into $TARGET_BRANCH" 2> /tmp/Error + git merge origin/"$PR_BRANCH" --no-ff -m "[ota] Merge remote-tracking branch 'origin/$PR_BRANCH' into $TARGET_BRANCH" 2> /tmp/Error else git commit --allow-empty -m "[ota]${COMMENT_BODY##/ota}" 2> /tmp/Error fi From 6a9f1bd2a171673632b9d2aeafa316b3a9807e57 Mon Sep 17 00:00:00 2001 From: s2mr Date: Thu, 16 Feb 2023 21:51:20 +0900 Subject: [PATCH 14/17] Hoge --- Scripts/my-script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/my-script.sh b/Scripts/my-script.sh index af44857..8180b11 100755 --- a/Scripts/my-script.sh +++ b/Scripts/my-script.sh @@ -12,7 +12,7 @@ trap error_handler ERR git config user.name 'Kazumasa Shimomura' git config user.email s2mr@users.noreply.github.com -TARGET_BRANCH=$(echo "$COMMENT_BODY" | sed 's/.*--into *\([^ ]*\).*/\1/') +TARGET_BRANCH=$(expr "$COMMENT_BODY" : '.*--into \([^ ]*\)') if [ "$TARGET_BRANCH" != "" ]; then git pull 2> /tmp/Error From 0bf086bed92352ed523d6888a41f8e3c6bc02fe5 Mon Sep 17 00:00:00 2001 From: s2mr Date: Thu, 16 Feb 2023 22:04:59 +0900 Subject: [PATCH 15/17] Fix --- Scripts/my-script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Scripts/my-script.sh b/Scripts/my-script.sh index 8180b11..d4adc16 100755 --- a/Scripts/my-script.sh +++ b/Scripts/my-script.sh @@ -7,13 +7,13 @@ function error_handler() { exit 1 } -trap error_handler ERR - git config user.name 'Kazumasa Shimomura' git config user.email s2mr@users.noreply.github.com TARGET_BRANCH=$(expr "$COMMENT_BODY" : '.*--into \([^ ]*\)') +trap error_handler ERR + if [ "$TARGET_BRANCH" != "" ]; then git pull 2> /tmp/Error git checkout "$TARGET_BRANCH" 2> /tmp/Error From 91715ecb390701ac2c1ddaffe98269c62df65884 Mon Sep 17 00:00:00 2001 From: Kazumasa Shimomura Date: Thu, 16 Feb 2023 13:05:25 +0000 Subject: [PATCH 16/17] [ota] From 11e53dee7ba0d991e3675f016aaefbb03d537815 Mon Sep 17 00:00:00 2001 From: s2mr Date: Thu, 16 Feb 2023 22:12:56 +0900 Subject: [PATCH 17/17] Add comment --- Scripts/my-script.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Scripts/my-script.sh b/Scripts/my-script.sh index d4adc16..bbee2fc 100755 --- a/Scripts/my-script.sh +++ b/Scripts/my-script.sh @@ -10,6 +10,8 @@ function error_handler() { git config user.name 'Kazumasa Shimomura' git config user.email s2mr@users.noreply.github.com +# 正規表現にマッチしない場合(e.g. --intoがない場合)はERRステータスになるので、 +# ERRのtrap はこれ以降で行う TARGET_BRANCH=$(expr "$COMMENT_BODY" : '.*--into \([^ ]*\)') trap error_handler ERR