Skip to content

Commit 72b7426

Browse files
committed
Allow spreadsheet id be configured via arguments.
1 parent 97c27ee commit 72b7426

2 files changed

Lines changed: 38 additions & 9 deletions

File tree

skills/rhdh-test-plan-review/SKILL.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ If the version cannot be determined from either field, ask: "I couldn't determin
4646
python scripts/fetch_schedule.py --version "1.6"
4747
```
4848

49+
Use `--sheet-id <id>` only when the schedule lives in a different spreadsheet than the default (e.g. a fork or replacement sheet).
50+
4951
Expected output:
5052
```json
5153
{
@@ -57,6 +59,16 @@ Expected output:
5759
}
5860
```
5961

62+
If the script returns `{"error": "spreadsheet_not_found"}`, ask:
63+
64+
> "I couldn't access the RHDH Release Schedule sheet (ID: `<spreadsheet_id>`). Please share the sheet URL or ID."
65+
66+
Extract the spreadsheet ID from the URL — it is the long alphanumeric string between `/d/` and `/edit` (e.g., `https://docs.google.com/spreadsheets/d/<ID>/edit`). Then retry:
67+
68+
```bash
69+
python scripts/fetch_schedule.py --version "1.6" --sheet-id <id>
70+
```
71+
6072
If the script returns `{"error": "version_not_found"}`, ask: "I couldn't find RHDH [version] milestones in the schedule sheet. Could you confirm the exact version string as it appears in the sheet?"
6173

6274
Use `code_freeze` and `ga_date` throughout the rest of the workflow.
@@ -341,6 +353,6 @@ After all child task decisions are collected, print a final summary of what was
341353
- **fixVersions format varies**: May be "1.6", "RHDH 1.6", "rhdh-1.6". Strip prefixes before passing to `fetch_schedule.py`.
342354
- **RHBK and Quay use doc version dropdowns**, not traditional lifecycle pages — see `references/sources.md` for extraction approach.
343355
- **PostgreSQL has three distinct hosting variants** (Amazon RDS, Azure DB, CloudSQL) — check each separately; EOL dates differ between providers.
344-
- **Schedule tab is year-based**: `fetch_schedule.py` tries current year first, then adjacent years. If the target RHDH version is in a future year, the script will still find it.
356+
- **Schedule tab is year-based**: `fetch_schedule.py` tries current year first, then adjacent years. If the target RHDH version is in a future year, the script will still find it. If the schedule lives in a different spreadsheet than the default, pass `--sheet-id` (error payloads include `spreadsheet_id` when lookup fails).
345357
- **Child task project key**: Use the same project key as the parent ticket (e.g., `RHIDP`). Extract it from the ticket ID.
346358
- **Child task issuetype**: Use `"Task"` — subtask creation requires `"Subtask"` on some Jira configurations. If `"Task"` with a `parent` field fails with 400, retry with `"issuetype": {"name": "Subtask"}`.

skills/rhdh-test-plan-review/scripts/fetch_schedule.py

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
import re
1616
import sys
1717
from datetime import datetime
18-
from pathlib import Path
19-
20-
SPREADSHEET_ID = "1knVzlMW0l0X4c7gkoiuaGql1zuFgEGwHHBsj-ygUTnc"
2118

2219
_no_color = os.environ.get("NO_COLOR") is not None
2320
_is_tty = sys.stderr.isatty() and not _no_color
@@ -70,8 +67,21 @@ def get_sheets_service():
7067
return build("sheets", "v4", credentials=creds)
7168

7269

73-
def get_sheet_tabs(service):
74-
meta = service.spreadsheets().get(spreadsheetId=SPREADSHEET_ID).execute()
70+
def get_sheet_tabs(service, spreadsheet_id):
71+
from googleapiclient.errors import HttpError
72+
73+
try:
74+
meta = service.spreadsheets().get(spreadsheetId=spreadsheet_id).execute()
75+
except HttpError as e:
76+
if e.resp.status == 404:
77+
error_exit(
78+
"spreadsheet_not_found",
79+
{
80+
"spreadsheet_id": spreadsheet_id,
81+
"hint": "The spreadsheet was not found. Pass the correct ID with --sheet-id or share the sheet URL.",
82+
},
83+
)
84+
raise
7585
return [s["properties"]["title"] for s in meta.get("sheets", [])]
7686

7787

@@ -195,21 +205,27 @@ def main():
195205
required=True,
196206
help="RHDH version to look up (e.g. '1.6', 'RHDH 1.6', 'rhdh-1.6')",
197207
)
208+
parser.add_argument(
209+
"--sheet-id",
210+
default="1knVzlMW0l0X4c7gkoiuaGql1zuFgEGwHHBsj-ygUTnc",
211+
help="RHDH Release Schedule spreadsheet ID",
212+
)
198213
args = parser.parse_args()
199214

200215
version = normalize_version(args.version)
216+
sheet_id = args.sheet_id
201217
log(f"Looking up milestones for RHDH {version}...")
202218

203219
service = get_sheets_service()
204-
tabs = get_sheet_tabs(service)
220+
tabs = get_sheet_tabs(service, sheet_id)
205221
log(f"Found tabs: {tabs}")
206222

207223
tab = find_schedule_tab(tabs)
208224
if not tab:
209-
error_exit("no_schedule_tab_found", {"tabs": tabs})
225+
error_exit("no_schedule_tab_found", {"tabs": tabs, "spreadsheet_id": sheet_id})
210226

211227
log(f"Reading tab: {tab}")
212-
result = service.spreadsheets().values().get(spreadsheetId=SPREADSHEET_ID, range=tab).execute()
228+
result = service.spreadsheets().values().get(spreadsheetId=sheet_id, range=tab).execute()
213229
rows = result.get("values", [])
214230

215231
milestones = find_milestones(rows, version)
@@ -220,6 +236,7 @@ def main():
220236
{
221237
"version": version,
222238
"tab": tab,
239+
"spreadsheet_id": sheet_id,
223240
"hint": "Check that the version string matches the sheet exactly",
224241
},
225242
)

0 commit comments

Comments
 (0)