feat: add Jira workflow and JSM approval actions#4889
Merged
Conversation
|
👋 Commands for maintainers:
|
## Summary This commit introduces new components for managing Jira workflows, enhancing the integration with Jira Service Management. ## Changes - Added **Approve Workflow** component to approve or decline Jira Service Management request approvals. - Introduced **Assign Workflow To Project** component to assign existing workflow schemes to company-managed projects. - Updated documentation to include new components and their configurations. - Added tests for the new components to ensure functionality and reliability. These additions aim to streamline workflow management within Jira, providing users with more control over their project configurations. Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
e0d90cb to
b2d7d8b
Compare
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
… retrieval This commit enhances the `GetWorkflowStatusesByName` method to ensure it only returns statuses for workflows with an exact name match, preventing incorrect status associations. It also updates the test cases to cover scenarios where workflows are not found, ensuring that errors are surfaced correctly. Additionally, the error handling in the workflow execution process is improved to provide clearer feedback when fetching workflow schemes and statuses fails. Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
This commit introduces a new function, `latestPendingApprovalID`, to determine the most recently created pending approval from a list of approvals. It enhances the `resolveApprovalID` method to utilize this new logic, improving the accuracy of approval selection. Additionally, new test cases are added to ensure the functionality works as expected under various scenarios, including cases with multiple pending approvals and no pending approvals. Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
…a client This commit removes the `GetProjectIssueTypeStatuses` function from the Jira client, as it is no longer needed. This cleanup helps streamline the codebase and improve maintainability. Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
This commit introduces a new feature to list pending approvals for Jira Service Management (JSM) requests. The `ListResources` method is updated to include a case for "jsmApproval", which calls a new helper function `listJSMApprovals`. This function filters and returns only the pending approvals associated with a given issue key. Additionally, comprehensive test cases are added to ensure the correct functionality of this new feature, including scenarios for valid and invalid issue keys. Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
This commit refactors the subtitle method in the Jira workflow mapper to streamline the logic for displaying the subtitle. It replaces multiple checks for workflow properties with a single timestamp check, improving code clarity and maintainability. Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Resolves the directory-rename conflict from main's pages/workflowv2 -> pages/app move (a8f7f13): the workflow mappers (approve/get/transition plus their specs) are relocated to web_src/src/pages/app/mappers/jira/. The mapper registrations in the merged index.ts are preserved. Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
GetWorkflowSchemeForProject skipped any workflow-scheme assignment whose inlined scheme had no id and returned nil. Jira omits the id for the built-in Default Workflow Scheme (common on company-managed projects that never customized it), so getWorkflow dropped workflowName and statuses for those projects even though transitions worked. Fall back to the inlined defaultWorkflow when the id is absent: per-issue-type mappings can't be fetched without an id, but the default workflow applies to every issue type that isn't explicitly remapped. Adds tests for the custom (id present), default (id absent), and team-managed (empty list) cases. Addresses a Cursor Bugbot review comment. Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
The default-scheme fallback in GetWorkflowSchemeForProject built a WorkflowSchemeDetail with empty IssueTypeMappings, so per-issue-type workflow overrides inlined in the project response were discarded and every issue type resolved via defaultWorkflow only. Unmarshal issueTypeMappings from the inlined workflowScheme object and carry them into the fallback detail. Extends the default-scheme test to assert an inlined mapping survives. Addresses a follow-up Cursor Bugbot review comment. Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Resolves content conflicts where main added the JSM Ops-alert components alongside this branch's workflow components: - pkg/integrations/jira/example.go: keep both the workflow and ops-alert embedded example outputs. - pkg/integrations/jira/client_test.go: git interleaved this branch's Test__GetWorkflowStatusesByName with main's Test__Client__OpsAlertsAPI; restored each as its complete function. - docs/components/Jira.mdx: regenerated via make gen.components.docs. The rest of the Jira package auto-merged; builds, vets, and tests pass. Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
isPendingApproval only matched finalDecision == PENDING, but JSM leaves the field empty for open approvals in some workflows. Those approvals were skipped in the picker and in latest-pending resolution, surfacing as 'no pending approval' errors while a decision was still required. Treat an empty decision as pending too (a completed approval always carries a concrete approved/declined decision). Adds a test for the empty-decision case. Addresses a Cursor Bugbot review comment. Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
applyStatusWithOptions pre-checked that a transition's screen exposes the resolution field but attached the comment unconditionally. Jira applies the comment as a transition-scoped field too, so transitioning with a comment on a screen that lacks the comment field was rejected with a generic 'not on the appropriate screen' error instead of failing early like resolution does. Pick a matching transition whose screen exposes every requested field (resolution and/or comment) and fail early with a clear, field-naming error otherwise. Tests cover the comment screen-check, the comment-missing error, and a plain status change with no fields. Addresses a Cursor Bugbot review comment. Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c50b702. Configure here.
The previous change required a transition's screen to list a comment field before attaching update.comment, but Jira accepts update.comment on most transitions even when the screen metadata omits it — so valid moves could fail with a screen-configuration error. Keep the strict screen check only for resolution (which Jira does gate via fields): prefer a transition whose screen exposes every requested field, but fall back to attaching the comment optimistically instead of erroring. Tests cover the prefer and fallback paths. Addresses a follow-up Cursor Bugbot review comment. Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
forestileao
approved these changes
Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Closes: #4904
Summary
This adds Jira workflow actions for inspecting issue workflows, transitioning issues, and handling Jira Service Management approvals, with docs and UI mappers.
Changes
jira.approveWorkflowto approve or decline Jira Service Management request approvals (latest pending or by approval id, with optional comment).jira.getWorkflowto return the workflow bound to an issue, including current status, all workflow statuses, and reachable transitions.jira.transitionIssueto move an issue to a target status via a valid workflow transition (optional comment and resolution).Demo
Screencast.from.2026-05-20.10-06-18.webm