chore(skills): Update duplicate-epic skill to work with bugs and stories#53
chore(skills): Update duplicate-epic skill to work with bugs and stories#53dlabrecq wants to merge 1 commit intopatternfly:mainfrom
Conversation
📝 WalkthroughWalkthroughUpdated the duplicate-epic skill to accept any Jira issue type (not just epics) as input and automatically resolve it to its parent epic. Enhanced the script to walk the issue hierarchy, filter media elements from descriptions, ignore link creation failures, and conditionally report the original input issue in output. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@plugins/issue-management/skills/duplicate-epic/SKILL.md`:
- Around line 81-82: Update the "Clone" step in the SKILL.md "What the Script
Does" section to state that the epic description is not copied verbatim: the
script sanitizes the description by stripping mediaSingle and media nodes
(attachments/embedded media) before creating the PF clone, and note that
embedded attachments will be removed in the PF copy; keep the existing "Ensure
'is duplicated by' link" text unchanged but ensure the doc reflects this
behavior and its failure mode (attachments lost) so users aren't surprised.
- Line 3: The frontmatter "description" in SKILL.md is too long and will be
truncated in listings; shorten it to under 250 characters, front-load key use
cases and include the trigger context "/duplicate-epic <issue> <feature>"
(mentioning that it duplicates a Jira epic into the PatternFly project and links
back to the original), and remove excess detail so the core purpose and trigger
are visible in the skill listing.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 07d7fca9-c7eb-49f1-ad64-1889ef5ecea5
📒 Files selected for processing (2)
plugins/issue-management/skills/duplicate-epic/SKILL.mdplugins/issue-management/skills/duplicate-epic/scripts/duplicate_epic.sh
| # Run in a subshell so a permission error here does not abort the rest of the script | ||
| if (api_request POST "issueLink" "$LINK_PAYLOAD" >/dev/null 2>&1); then | ||
| echo "Link added" | ||
| else | ||
| echo "WARNING: Could not add 'is duplicated by' link (likely missing link-issue permission in the source project). Continuing..." >&2 | ||
| fi |
There was a problem hiding this comment.
Don't continue after a failed link on a newly created clone.
Step 4 only discovers existing PF copies via the Duplicate link on the source epic. If this POST fails after creating NEW_KEY, the script still exits successfully, and the next run will miss that clone and create another one.
At minimum, keep this non-fatal only when NEW_KEY already existed; if the clone was just created, fail here or persist some other dedupe marker before continuing.
Possible fix
+CREATED_NEW_CLONE=0
if [[ -n "$NEW_KEY" ]]; then
echo "Found existing clone: $NEW_KEY"
else
echo "Cloning $ORIGINAL_KEY into $PF_PROJECT project..."
@@
NEW_KEY=$(api_request POST "issue" "$PAYLOAD" | jq -r '.key')
echo "Created: $NEW_KEY"
+ CREATED_NEW_CLONE=1
fi
@@
- if (api_request POST "issueLink" "$LINK_PAYLOAD" >/dev/null 2>&1); then
+ if api_request POST "issueLink" "$LINK_PAYLOAD" >/dev/null 2>&1; then
echo "Link added"
+ elif [[ "$CREATED_NEW_CLONE" -eq 0 ]]; then
+ echo "WARNING: Could not add 'is duplicated by' link (likely missing link-issue permission in the source project). Continuing..." >&2
else
- echo "WARNING: Could not add 'is duplicated by' link (likely missing link-issue permission in the source project). Continuing..." >&2
+ echo "ERROR: Created $NEW_KEY but could not add the duplicate link; aborting to avoid future duplicate clones." >&2
+ exit 1
fi
fi| --- | ||
| name: duplicate-epic | ||
| description: Duplicates an Atlassian Jira epic into the PatternFly (PF) project space, adds an "is duplicated by" link referencing the original, and assigns it as a child of a given feature. This allows the PatternFly team to trace Jira work items up a hierarchy in the product Jira project. Use when asked to "duplicate epic X for feature Y", clone a COST epic to PatternFly, or replicate a Jira epic under a PF feature. | ||
| description: Duplicates an Atlassian Jira epic into the PatternFly (PF) project space, adds an "is duplicated by" link referencing the original, and assigns it as a child of a given feature. This allows the PatternFly team to trace Jira work items up a hierarchy in the product Jira project. Use when the command is "/duplicate-epic <issue> <feature>" where the first argument is any Jira issue key (Epic, Story, or Bug — the script resolves the parent epic automatically) and the second argument is the PF feature to assign the new epic to. |
There was a problem hiding this comment.
Shorten the frontmatter description.
This now exceeds the skill-listing limit, so the /duplicate-epic <issue> <feature> trigger text is likely to be truncated where users discover the skill.
Possible fix
-description: Duplicates an Atlassian Jira epic into the PatternFly (PF) project space, adds an "is duplicated by" link referencing the original, and assigns it as a child of a given feature. This allows the PatternFly team to trace Jira work items up a hierarchy in the product Jira project. Use when the command is "/duplicate-epic <issue> <feature>" where the first argument is any Jira issue key (Epic, Story, or Bug — the script resolves the parent epic automatically) and the second argument is the PF feature to assign the new epic to.
+description: Use when `/duplicate-epic <issue> <feature>` should clone a Jira Epic, Story, or Bug into the PF project, resolve non-epic inputs to their parent epic, link back to the source, and attach the new epic to a PF feature.As per coding guidelines, "The description should include trigger contexts (e.g., 'Use when...') and be front-loaded with key use cases — descriptions longer than 250 characters are truncated in the skill listing."
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| description: Duplicates an Atlassian Jira epic into the PatternFly (PF) project space, adds an "is duplicated by" link referencing the original, and assigns it as a child of a given feature. This allows the PatternFly team to trace Jira work items up a hierarchy in the product Jira project. Use when the command is "/duplicate-epic <issue> <feature>" where the first argument is any Jira issue key (Epic, Story, or Bug — the script resolves the parent epic automatically) and the second argument is the PF feature to assign the new epic to. | |
| description: Use when `/duplicate-epic <issue> <feature>` should clone a Jira Epic, Story, or Bug into the PF project, resolve non-epic inputs to their parent epic, link back to the source, and attach the new epic to a PF feature. |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@plugins/issue-management/skills/duplicate-epic/SKILL.md` at line 3, The
frontmatter "description" in SKILL.md is too long and will be truncated in
listings; shorten it to under 250 characters, front-load key use cases and
include the trigger context "/duplicate-epic <issue> <feature>" (mentioning that
it duplicates a Jira epic into the PatternFly project and links back to the
original), and remove excess detail so the core purpose and trigger are visible
in the skill listing.
| 4. **Clone** — if no clone exists, creates a new Epic in the `PF` project copying the summary, description, and labels. | ||
| 5. **Ensure "is duplicated by" link** — adds a `Duplicate` link so the new epic displays "is duplicated by {ORIGINAL EPIC}" in its linked work items; skips if already present. |
There was a problem hiding this comment.
Document the description sanitization here.
The script no longer copies the description verbatim; it strips mediaSingle/media nodes before create. Calling it a straight copy will surprise users when embedded attachments disappear in the PF clone.
As per coding guidelines, "In “What the Script Does,” keep the workflow aligned with the script’s behavior and failure modes."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@plugins/issue-management/skills/duplicate-epic/SKILL.md` around lines 81 -
82, Update the "Clone" step in the SKILL.md "What the Script Does" section to
state that the epic description is not copied verbatim: the script sanitizes the
description by stripping mediaSingle and media nodes (attachments/embedded
media) before creating the PF clone, and note that embedded attachments will be
removed in the PF copy; keep the existing "Ensure 'is duplicated by' link" text
unchanged but ensure the doc reflects this behavior and its failure mode
(attachments lost) so users aren't surprised.
Updated duplicate-epic skill to work with different JIra bugs in addition to stories.
SKILL.md
scripts/duplicate_epic.sh
Summary by CodeRabbit
New Features
Bug Fixes
Documentation