@jira-deploy/core 1.0.11 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/tools/release.js CHANGED
@@ -8,7 +8,7 @@
8
8
  import https from 'https';
9
9
  import http from 'http';
10
10
  import { error, getModuleName, ok } from './helpers.js';
11
- import { SYSTEM_CODES, SYSTEM_MODULES } from '../constants/index.js';
11
+ import {getDeployConfig, getReleaseProjectKey, SYSTEM_CODES, SYSTEM_MODULES} from '../constants/index.js';
12
12
 
13
13
  // ── Schema definitions ───────────────────────────────────────────
14
14
  export function getReleaseToolDefinitions() {
@@ -16,7 +16,7 @@ export function getReleaseToolDefinitions() {
16
16
  {
17
17
  name: 'get_unreleased_versions',
18
18
  description:
19
- '查詢 LBPRJ 所有 unreleased versions。可依 systemCode 篩選,自動解析版本名稱為 module + branch。',
19
+ '查詢 release 專案所有 unreleased versions。可依 systemCode 篩選,自動解析版本名稱為 module + branch。',
20
20
  inputSchema: {
21
21
  type: 'object',
22
22
  required: [],
@@ -29,7 +29,7 @@ export function getReleaseToolDefinitions() {
29
29
  },
30
30
  projectKey: {
31
31
  type: 'string',
32
- description: '(選填) Jira 專案 key,預設 LBPRJ',
32
+ description: '(選填) Jira 專案 key,預設讀 JIRA_RELEASE_PROJECT_KEY 或 JIRA_DEPLOY_CONFIG_PATH',
33
33
  },
34
34
  },
35
35
  },
@@ -52,7 +52,7 @@ export function getReleaseToolDefinitions() {
52
52
  {
53
53
  name: 'get_release_manager',
54
54
  description:
55
- '查詢指定日期的 STG release 值班組長(從 Confluence Team Calendar 讀取 Sign off staff 事件)。今日 4/26 是 Alvin Wang BK00236。',
55
+ '查詢指定日期的 release 值班人員(從 Confluence Team Calendar 讀取 Sign off staff 事件)。',
56
56
  inputSchema: {
57
57
  type: 'object',
58
58
  required: [],
@@ -67,7 +67,7 @@ export function getReleaseToolDefinitions() {
67
67
  {
68
68
  name: 'wait_for_comment',
69
69
  description:
70
- '輪詢等待 Jira issue 出現包含特定關鍵字的 comment。用於等待 James Yu (BK00178) 在 UAT CD 單留 "Approved" 等場景。',
70
+ '輪詢等待 Jira issue 出現包含特定關鍵字的 comment。可選擇限定 comment 作者。',
71
71
  inputSchema: {
72
72
  type: 'object',
73
73
  required: ['issueKey', 'keyword'],
@@ -82,7 +82,7 @@ export function getReleaseToolDefinitions() {
82
82
  },
83
83
  authorAccountId: {
84
84
  type: 'string',
85
- description: '(選填) 限定特定用戶的 comment,例如 BK00178(James Yu)',
85
+ description: '(選填) 限定特定用戶的 comment accountId',
86
86
  },
87
87
  timeoutMs: {
88
88
  type: 'number',
@@ -102,7 +102,7 @@ export function getReleaseToolDefinitions() {
102
102
 
103
103
  export async function handleGetUnreleasedVersions(args, { jira }) {
104
104
  try {
105
- const projectKey = args.projectKey ?? 'LBPRJ';
105
+ const projectKey = args.projectKey ?? getReleaseProjectKey();
106
106
  const versions = await jira.getUnreleasedVersionsList(projectKey);
107
107
 
108
108
  if (!args.systemCode) {
@@ -165,9 +165,12 @@ export async function handleGetReleaseManager(args, _ctx) {
165
165
  return ok({
166
166
  date,
167
167
  found: true,
168
- name: 'Alvin Wang',
168
+ name: getDeployConfig().release.dryRunManager.name,
169
169
  dryRun: true,
170
- event: { what: 'Sign off staff', who: 'Alvin Wang (BK00236)' },
170
+ event: {
171
+ what: 'Sign off staff',
172
+ who: `${getDeployConfig().release.dryRunManager.name} (${getDeployConfig().release.dryRunManager.accountId})`,
173
+ },
171
174
  });
172
175
  }
173
176
 
@@ -177,8 +180,11 @@ export async function handleGetReleaseManager(args, _ctx) {
177
180
  return error('缺少環境變數 CONF_BASE_URL 或 CONF_TOKEN');
178
181
  }
179
182
 
180
- // Release Manager 值班表的 sub-calendar ID(來自 wiki 頁 109861360)
181
- const SUB_CALENDAR_ID = '7e83502d-7994-4d90-87c2-9268e5d7d565';
183
+ const SUB_CALENDAR_ID = process.env.CONF_RELEASE_MANAGER_SUB_CALENDAR_ID
184
+ ?? getDeployConfig().release.managerSubCalendarId;
185
+ if (!SUB_CALENDAR_ID) {
186
+ return error('缺少環境變數 CONF_RELEASE_MANAGER_SUB_CALENDAR_ID 或 release.managerSubCalendarId config');
187
+ }
182
188
 
183
189
  const nextDay = new Date(date);
184
190
  nextDay.setDate(nextDay.getDate() + 1);