From d140ae43b6513967cd4d2afd0728ba079d728bb3 Mon Sep 17 00:00:00 2001 From: Kengo TODA Date: Thu, 21 Dec 2023 08:53:37 +0800 Subject: [PATCH 1/5] ci: replace hub command with official GitHub CLI Signed-off-by: Kengo TODA --- scripts/check-for-new-master-data.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/check-for-new-master-data.sh b/scripts/check-for-new-master-data.sh index 42de589..4dc5c78 100755 --- a/scripts/check-for-new-master-data.sh +++ b/scripts/check-for-new-master-data.sh @@ -1,7 +1,7 @@ #!/bin/bash # Exit if pull request already exists -if [ -n "$(hub pr list -h new-master-data-*)" ]; then +if [ -n "$(gh pr list -H new-master-data-* --state open)" ]; then echo "Pull request already exists." exit 0 fi @@ -29,7 +29,7 @@ if [ ! -f "raw-master-data/s/$file_name" ]; then git add . git commit -m "Add new master data for $date" git push origin "new-master-data-${date}" - hub pull-request -m "Add new master data for ${date}" -b master -h "new-master-data-${date}" + gh pr create -m "Add new master data for ${date}" -B master -H "new-master-data-${date}" else echo "No new master data available." fi From 13bfbf64821cf94f60fa4f762d2955828d73e4a0 Mon Sep 17 00:00:00 2001 From: Kengo TODA Date: Thu, 21 Dec 2023 08:55:17 +0800 Subject: [PATCH 2/5] ci: set GH_TOKEN env var Signed-off-by: Kengo TODA --- .github/workflows/check-for-new-master-data.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/check-for-new-master-data.yaml b/.github/workflows/check-for-new-master-data.yaml index 020838c..a02f0b8 100644 --- a/.github/workflows/check-for-new-master-data.yaml +++ b/.github/workflows/check-for-new-master-data.yaml @@ -18,3 +18,5 @@ jobs: run: | chmod +x ./scripts/check-for-new-master-data.sh ./scripts/check-for-new-master-data.sh + env: + GH_TOKEN: ${{ github.token }} From 727d49aa4ea69d7f44aa97461cf20ed4a06a8c89 Mon Sep 17 00:00:00 2001 From: Kengo TODA Date: Thu, 21 Dec 2023 08:58:22 +0800 Subject: [PATCH 3/5] ci: set title and body of PR Signed-off-by: Kengo TODA --- scripts/check-for-new-master-data.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check-for-new-master-data.sh b/scripts/check-for-new-master-data.sh index 4dc5c78..92decbd 100755 --- a/scripts/check-for-new-master-data.sh +++ b/scripts/check-for-new-master-data.sh @@ -29,7 +29,7 @@ if [ ! -f "raw-master-data/s/$file_name" ]; then git add . git commit -m "Add new master data for $date" git push origin "new-master-data-${date}" - gh pr create -m "Add new master data for ${date}" -B master -H "new-master-data-${date}" + gh pr create --title "Add new master data for ${date}" --body "This PR was created automatically by GitHub Actions" -B master -H "new-master-data-${date}" else echo "No new master data available." fi From eec226b4ccd990ddb9b047b60748817b9bd86122 Mon Sep 17 00:00:00 2001 From: Kengo TODA Date: Thu, 21 Dec 2023 08:59:59 +0800 Subject: [PATCH 4/5] ci: fix base branch Signed-off-by: Kengo TODA --- scripts/check-for-new-master-data.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check-for-new-master-data.sh b/scripts/check-for-new-master-data.sh index 92decbd..9908fde 100755 --- a/scripts/check-for-new-master-data.sh +++ b/scripts/check-for-new-master-data.sh @@ -29,7 +29,7 @@ if [ ! -f "raw-master-data/s/$file_name" ]; then git add . git commit -m "Add new master data for $date" git push origin "new-master-data-${date}" - gh pr create --title "Add new master data for ${date}" --body "This PR was created automatically by GitHub Actions" -B master -H "new-master-data-${date}" + gh pr create --title "Add new master data for ${date}" --body "This PR was created automatically by GitHub Actions" -B main -H "new-master-data-${date}" else echo "No new master data available." fi From cfafa48b73f3d58ca47f4b66d1c29fcccc76ea0c Mon Sep 17 00:00:00 2001 From: Kengo TODA Date: Thu, 21 Dec 2023 09:06:49 +0800 Subject: [PATCH 5/5] ci: search by head branch name Signed-off-by: Kengo TODA --- scripts/check-for-new-master-data.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check-for-new-master-data.sh b/scripts/check-for-new-master-data.sh index 9908fde..f4b767e 100755 --- a/scripts/check-for-new-master-data.sh +++ b/scripts/check-for-new-master-data.sh @@ -1,7 +1,7 @@ #!/bin/bash # Exit if pull request already exists -if [ -n "$(gh pr list -H new-master-data-* --state open)" ]; then +if [ -n "$(gh pr list --search head:new-master-data --state open)" ]; then echo "Pull request already exists." exit 0 fi