feat(啟動橫幅與 log 格式): 啟動輸出 Action 資訊橫幅並統一 log 訊息為 [等級][時間] 格式

This commit is contained in:
Jeffery
2026-06-30 12:42:11 +08:00
parent b14b676d0c
commit 2e5c46b893
2 changed files with 58 additions and 7 deletions
Regular → Executable
+15 -3
View File
@@ -1,15 +1,27 @@
#!/bin/bash
# =============================================================================
# 用途: calculate-version Action 的容器進入點 (entrypoint)。
# 專案已由 bash 改寫為 Node.js,本腳本僅負責啟動 /app/index.js,
# 並將容器收到的引數原封傳遞給 Node.js 程式執行版本計算邏輯
# 更新日期: 2026/06/26 10:28:36
# 專案已由 bash 改寫為 Node.js,本腳本先輸出 Action 資訊橫幅,
# 再啟動 /app/index.js,並將容器收到的引數原封傳遞給 Node.js 程式。
# 更新日期: 2026/06/30 12:12:56
# =============================================================================
# set -e: 任一指令失敗即中止; set -u: 使用未定義變數即報錯;
# set -o pipefail: 管線中任一指令失敗即視為整體失敗。確保錯誤能即時暴露。
set -euo pipefail
# Action 基本資訊:與 action.yaml 的 name/description 一致;更新時間為本腳本最後異動的台灣時間。
ACTION_NAME='Calculate Version'
ACTION_DESC='計算版本號'
ACTION_UPDATED='2026/06/30 12:12:56'
# 啟動時印出 Action 名稱 / 用途 / 更新時間橫幅,方便在 CI/容器 log 中辨識本次執行。
printf '\n%s\n' '=================================================='
printf '名稱 : %s\n' "$ACTION_NAME"
printf '用途 : %s\n' "$ACTION_DESC"
printf '更新 : %s\n' "$ACTION_UPDATED"
printf '%s\n' '=================================================='
# 進入點:實際邏輯改以 Node.js 實作,置於 /app
# 以 exec 取代當前 shell,讓 node 成為 PID 1 正確接收訊號;
# "$@" 將容器接收到的所有引數原樣轉交給 Node.js 程式。