--- name: maintenance-create-ticket-on-jira description: Create or update a Jira ticket for a workload maintenance upgrade, based on maintenance upgrade check files. --- # Create Maintenance Upgrade Ticket on Jira Skill Run this skill when asked to create or update a Jira maintenance upgrade ticket based on maintenance upgrade check file(s) under `maintenance-checks` directory at the root of the working directory. This skill reads maintenance upgrade check files, extracts the details related to Jira ticket title and description, then creates or updates the corresponding issue in the configured Jira project. ## Configuration Update the values below with your Jira project details before using this skill: | Setting | Value | |---|---| | Atlassian Site | `.atlassian.net` | | Jira Project Key | `` (e.g. `OPS`, `INFRA`) | --- ## Step 1 — Locate maintenance upgrade check file(s) Find all maintenance upgrade check files in the `./maintenance-checks/` directory: ```bash ls ./maintenance-checks/maintenance-check-*.md ``` If the user specified a particular file, use that. If multiple files are found and none was specified, list them and ask the user which one(s) to process. Process one file at a time — after completing all steps for a file, return to this step and process the next selected file. --- ## Step 2 — Parse the maintenance upgrade file Read the maintenance upgrade check file and extract: - **Maintenance upgrade required** — from the `## Decision` → `**Maintenance upgrade required:**` field - **Ticket title** — from the `## Jira Ticket` → `**Title:**` field - **Parent** — from the `## Jira Ticket` → `**Parent:**` field - **Label** — from the `## Jira Ticket` → `**Label:**` field - **Story Points** — from the `## Jira Ticket` → `**Story Points:**` field - **Refined** — from the `## Jira Ticket` → `**Refined:**` field - **Ticket description** — from the `## Jira Ticket` → `**Description:**` block (everything after `**Description:**` to the end of the file) If any extracted field or block is missing or blank, report: `"Cannot proceed: '' is missing in "` and stop. If `Maintenance upgrade required: No`, inform the user that no maintenance upgrade ticket is needed for this file and stop. --- ## Step 3 — Build the JSON payload(s) Jira requires **Atlassian Document Format (ADF)** for rich text, and custom fields must be set at creation time via `additionalAttributes` (the `edit` command does not support custom fields). First, ensure the `./tmp/` directory exists: ```bash mkdir -p ./tmp ``` Parse the markdown description and produce an ADF document following these rules: - Each blank-line-separated paragraph → `{"type":"paragraph","content":[...]}` - `**bold text**` → `{"type":"text","text":"bold text","marks":[{"type":"strong"}]}` - `` `code` `` → `{"type":"text","text":"code","marks":[{"type":"code"}]}` - `**N. Heading text**` when the entire paragraph consists solely of this pattern (i.e. `**. **` with nothing else on the line) → `{"type":"heading","attrs":{"level":3},"content":[{"type":"text","text":"N. Heading text"}]}` — this takes priority over the bold text rule; do NOT apply it when the bold span appears alongside other inline content - `## Heading text` → `{"type":"heading","attrs":{"level":2},"content":[{"type":"text","text":"Heading text"}]}` - `### Heading text` → `{"type":"heading","attrs":{"level":3},"content":[{"type":"text","text":"Heading text"}]}` - Bullet list items (`- item`) → `{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[...]}]},...]}` — group consecutive items into one `bulletList` node; indented sub-items (` - subitem`, two-space indent) → nest a second `bulletList` inside the parent `listItem`'s content array - Markdown tables → `{"type":"table","attrs":{"isNumberColumnEnabled":false,"layout":"default"},"content":[]}` where each row is `{"type":"tableRow","content":[]}` and each cell is either `{"type":"tableHeader","content":[...]}` (header row) or `{"type":"tableCell","content":[...]}` (data rows); each cell wraps its text in a paragraph node - Plain URLs (starting with `http`) inside text → `{"type":"text","text":"","marks":[{"type":"link","attrs":{"href":""}}]}` - Markdown links (`[label](url)`) → `{"type":"text","text":"label","marks":[{"type":"link","attrs":{"href":"url"}}]}` - Inline `- label: url` reference lines → render as a paragraph with the label as plain text followed by the URL as a link mark - Numbered list items (`1. item`, `2. item`) → `{"type":"orderedList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[...]}]},...]}` — group consecutive items into one `orderedList` node - Fenced code blocks (` ``` ... ``` `) → `{"type":"codeBlock","attrs":{"language":""},"content":[{"type":"text","text":""}]}` — use the language hint if specified (e.g. ` ```bash `), otherwise leave `language` as an empty string - Horizontal rules (`---` on its own line) → `{"type":"rule"}` Always write the ADF description object alone to `./tmp/jira-description.json` (used by the update path in Step 6): ```json { "version": 1, "type": "doc", "content": [ ... ] } ``` For the **create** path, also write the complete payload to `./tmp/jira-create.json`: ```json { "projectKey": "", "type": "Story", "summary": "", "parentIssueId": "", "labels": ["