Generate bug fix release notes from Jira tickets and linked GitHub PRs
Generates bug fix release notes from Jira tickets and linked GitHub PRs.
/plugin marketplace add openshift-eng/ai-helpers/plugin install jira@ai-helpers<issue-key>jira:create-release-note
/jira:create-release-note <issue-key>
The jira:create-release-note command automatically generates bug fix release notes by analyzing Jira bug tickets and their linked GitHub pull requests, then updates the Jira ticket with the generated release note content.
This command is particularly useful for:
The command follows the standard release note template format and populates both the Release Note Type and Release Note Text fields in Jira.
The jira:create-release-note command runs in multiple phases:
Fetch bug ticket using mcp__atlassian__jira_get_issue MCP tool:
Validate issue type:
Parse bug description to extract required sections:
Handle missing sections:
Extract all linked GitHub PR URLs from multiple sources:
Remote links (Primary source - web links in Jira):
remotelinks, issuelinks with outwardIssue.fields.issuetype.name == "GitHub PR"https://github.com/{org}/{repo}/pull/{number}{org}/{repo} and {number}Description text: Scan bug description for GitHub PR URLs
https://github\.com/[\w-]+/[\w-]+/pull/\d+gh issue view {JIRA-KEY} - Jira keys are not GitHub issuesComments: Scan bug comments for GitHub PR URLs
Deduplicate: Create unique set of PR URLs
Search by bug number (Fallback if no PR URLs found):
# Try common OpenShift repos
for repo in "openshift/hypershift" "openshift/cluster-api-provider-aws" "openshift/origin"; do
gh pr list --repo $repo --search "{issue-key} in:title,body" --state all --limit 10 --json number,url,title
done
gh issue view {JIRA-KEY} - this will fail because Jira keys are not GitHub issue numbersValidate: Ensure at least one PR is found
For each linked PR, analyze multiple sources to extract Fix, Result, and Workaround information:
Extract repository and PR number from URL:
https://github.com/{org}/{repo}/pull/{number}{org}/{repo} as REPO, {number} as PR_NUMBERFetch PR details using gh CLI:
gh pr view {PR_NUMBER} --json body,title,commits,url,state --repo {REPO}
Fetch PR diff using gh CLI:
gh pr diff {PR_NUMBER} --repo {REPO}
Fetch PR comments using gh CLI:
gh pr view {PR_NUMBER} --json comments --repo {REPO}
Analyze all sources:
Extract key information:
Combine information from all analyzed PRs into a cohesive release note:
Combine Cause/Consequence from Jira bug:
Synthesize Fix from all PRs:
Synthesize Result from all PRs:
Extract Workaround (if applicable):
Format according to template:
Cause: <extracted from bug description>
Consequence: <extracted from bug description>
Fix: <synthesized from PR analysis>
Result: <synthesized from PR analysis>
Workaround: <synthesized from PR analysis if applicable>
Scan the generated release note text for sensitive data before submission:
Prohibited content patterns:
https://user:pass@example.comScanning approach:
Action if detected:
<redacted>, YOUR_API_KEY, etc.)Prompt user to select the appropriate Release Note Type:
Available options (from Jira dropdown):
Auto-detection (optional):
User confirmation:
AskUserQuestion tool for interactive selectionUpdate the Jira bug ticket with generated release note:
Prepare fields for update:
{
"customfield_12320850": {"value": "<Release Note Type>"},
"customfield_12317313": "<Release Note Text>"
}
Update using MCP tool:
mcp__atlassian__jira_update_issue(
issue_key=<issue-key>,
fields={
"customfield_12320850": {"value": "Bug Fix"},
"customfield_12317313": "<formatted release note text>"
}
)
Handle update errors:
Show the user what was created:
Display generated release note:
Release Note Created for {issue-key}
Type: Bug Fix
Text:
---
Cause: ...
Consequence: ...
Fix: ...
Result: ...
Workaround: ...
---
Updated: https://issues.redhat.com/browse/{issue-key}
Provide next steps:
OCPBUGS-12345).
Must be a valid bug ticket with linked GitHub PRs.Create release note for a bug with linked PRs:
/jira:create-release-note OCPBUGS-38358
The command will:
Analyzing OCPBUGS-38358...
Found bug: "hostedcontrolplane controller crashes when hcp.Spec.Platform.AWS.CloudProviderConfig.Subnet.ID is undefined"
Extracted from bug description:
Cause: hostedcontrolplane controller crashes when hcp.Spec.Platform.AWS.CloudProviderConfig.Subnet.ID is undefined
Consequence: control-plane-operator enters a crash loop
Found 1 linked GitHub PR:
- https://github.com/openshift/hypershift/pull/4567
Analyzing PR #4567...
Title: "Fix panic when CloudProviderConfig.Subnet is not specified"
Commits: 2
Files changed: 3
Synthesizing release note...
Select Release Note Type:
1. Bug Fix
2. Release Note Not Required
3. Known Issue
4. Enhancement
5. CVE
Selection: 1 (Bug Fix)
Updating Jira ticket...
✓ Release Note Created for OCPBUGS-38358
Type: Bug Fix
Text:
---
Cause: hostedcontrolplane controller crashes when hcp.Spec.Platform.AWS.CloudProviderConfig.Subnet.ID is undefined
Consequence: control-plane-operator enters a crash loop
Fix: Added nil check for CloudProviderConfig.Subnet before accessing Subnet.ID field
Result: The control-plane-operator no longer crashes when CloudProviderConfig.Subnet is not specified
---
Updated: https://issues.redhat.com/browse/OCPBUGS-38358
Scenario: Bug ticket has no linked GitHub PRs.
Error Message:
No GitHub PRs found linked to OCPBUGS-12345.
To generate a release note, please link at least one GitHub PR to this bug.
How to link PRs:
1. Edit the bug in Jira
2. Add a web link to the GitHub PR URL
3. Or mention the PR URL in a comment
4. Then run this command again
Action: Exit without updating the ticket.
Scenario: One or more linked PRs cannot be accessed.
Warning Message:
Warning: Unable to access PR https://github.com/org/repo/pull/123
Verify the PR exists and you have permissions.
Continuing with remaining PRs...
Action: Skip the inaccessible PR, continue with others. If all PRs are inaccessible, treat as "No PRs" error.
Scenario: Bug description doesn't contain required Cause and/or Consequence sections.
Error Message:
Bug description is missing required sections:
- Missing: Cause
- Missing: Consequence
Please update the bug description to include these sections.
Template format:
---
Description of problem:
<problem description>
Cause:
<root cause of the problem>
Consequence:
<impact or effect of the problem>
Steps to Reproduce:
1. ...
---
Would you like to provide Cause and Consequence interactively? (yes/no)
Action:
Scenario: Generated release note contains potential credentials or secrets.
Error Message:
Security validation failed!
Detected what appears to be an API token in the release note text.
This may have come from:
- PR description
- Commit messages
- Code changes
- PR comments
Please review the source PRs and remove any credentials before proceeding.
Use placeholder values instead:
- YOUR_API_KEY
- <redacted>
- ********
Aborting release note creation.
Action: Stop immediately, do not update Jira ticket.
Scenario: User doesn't have permission to update Release Note fields.
Error Message:
Failed to update OCPBUGS-12345.
Error: You do not have permission to edit field 'Release Note Type'
This may require specific Jira permissions. Please contact your Jira administrator or use the Jira web UI to add the release note manually.
Generated release note (for manual entry):
---
Cause: ...
Consequence: ...
...
---
Action: Display the generated release note so user can manually copy it.
Scenario: Selected release note type is not valid for this Jira instance.
Error Message:
Failed to update Release Note Type field.
Error: Value "Bug Fix" is not valid for field customfield_12320850
This may indicate a Jira configuration issue. Please verify the allowed values for Release Note Type in your Jira instance.
Action: Ask user to select a different type or manually update in Jira.
Scenario: Multiple PRs describe different fixes or contradictory information.
Warning Message:
Found 3 linked PRs with different fix descriptions:
- PR #123: Fix A
- PR #456: Fix B
- PR #789: Fix C
Combining all fixes into a single release note...
Action: Use AI to synthesize a coherent narrative combining all fixes. If truly contradictory, ask user for clarification.
MCP Jira Server: Must be configured and accessible
GitHub CLI (gh): Must be installed and authenticated
brew install gh (macOS) or see GitHub CLI docsgh auth logingh auth statusAccess to GitHub Repositories: Must have read access to repos where PRs are located
Jira Permissions:
GitHub Permissions:
jira:solve - Analyze and solve Jira issuesjira:create - Create Jira issues with guided workflowsjira:generate-test-plan - Generate test plans for PRsjira:status-rollup - Create status rollup reportsThe command uses these Jira custom field IDs:
customfield_12320850: Release Note Type (dropdown)customfield_12317313: Release Note Text (text field)These field IDs are specific to Red Hat's Jira instance. If using a different Jira instance, you may need to update the field IDs.
The gh CLI is subject to GitHub API rate limits:
The release note follows this structure:
This format is standard for Red Hat bug fix release notes.