From 21446449e4f00b6ce8ba8648a93abf34b7ef3d8b Mon Sep 17 00:00:00 2001 From: Yohei Yasukawa Date: Thu, 4 Sep 2025 15:11:50 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=E3=83=87=E3=83=97=E3=83=AD=E3=82=A4?= =?UTF-8?q?=E6=99=82=E3=81=AE=E3=82=B3=E3=83=9F=E3=83=83=E3=83=88=E3=83=A1?= =?UTF-8?q?=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E3=81=AB=20PR=E7=95=AA?= =?UTF-8?q?=E5=8F=B7=E3=82=92=E8=87=AA=E5=8B=95=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 目的: - PR送信者がマージ後のサーバー作成を確認しやすくする - 手動でのコメント追加を不要にする 実装内容: 1. マージコミットメッセージから PR番号を抽出 2. コミットメッセージに PR番号を含める 3. 追加されたサーバー名も表示(オプション) 結果: - 'Deploy from actions' → 'Deploy from actions (PR #256)' - GitHub が自動的に PR へのリンクを作成 - PR ページから instances.csv の更新が追跡可能 --- bin/deploy.sh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/bin/deploy.sh b/bin/deploy.sh index 200552c..7943a28 100644 --- a/bin/deploy.sh +++ b/bin/deploy.sh @@ -10,5 +10,22 @@ git config user.email "yohei@yasslab.jp" git add -f README.md git add -f instances.csv -git commit --quiet -m "Deploy from actions" +# マージコミットメッセージから PR番号を抽出 +PR_NUMBER=$(git log -1 --pretty=%B | grep -oE '#[0-9]+' | head -1 || echo "") + +# コミットメッセージを動的に生成 +if [ -n "$PR_NUMBER" ]; then + COMMIT_MSG="Deploy from actions (PR $PR_NUMBER)" +else + COMMIT_MSG="Deploy from actions" +fi + +# 追加されたサーバー情報を取得(オプション) +NEW_SERVERS=$(git diff --cached instances.csv | grep '^+' | grep -v '^+++' | cut -d',' -f1 | sed 's/^+//' | head -3 | paste -sd ', ' || echo "") + +if [ -n "$NEW_SERVERS" ]; then + COMMIT_MSG="$COMMIT_MSG - Added: $NEW_SERVERS" +fi + +git commit --quiet -m "$COMMIT_MSG" git push --force --quiet "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" master:gh-pages