Skip to content

feat: add Jira workflow and JSM approval actions#4889

Merged
forestileao merged 18 commits into
superplanehq:mainfrom
WashingtonKK:feat/jira-workflows
Jun 8, 2026
Merged

feat: add Jira workflow and JSM approval actions#4889
forestileao merged 18 commits into
superplanehq:mainfrom
WashingtonKK:feat/jira-workflows

Conversation

@WashingtonKK

@WashingtonKK WashingtonKK commented May 19, 2026

Copy link
Copy Markdown
Collaborator

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

  • Added jira.approveWorkflow to approve or decline Jira Service Management request approvals (latest pending or by approval id, with optional comment).
  • Added jira.getWorkflow to return the workflow bound to an issue, including current status, all workflow statuses, and reachable transitions.
  • Added jira.transitionIssue to 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

@superplanehq-integration

Copy link
Copy Markdown

👋 Commands for maintainers:

  • /sp start - Start an ephemeral machine (takes ~30s)
  • /sp stop - Stop a running machine (auto-executed on pr close)

## 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>
@WashingtonKK WashingtonKK force-pushed the feat/jira-workflows branch from e0d90cb to b2d7d8b Compare May 19, 2026 09:31
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
@WashingtonKK WashingtonKK marked this pull request as ready for review May 19, 2026 14:44
Comment thread pkg/integrations/jira/client.go
@WashingtonKK WashingtonKK changed the title feat: add Jira workflow components for approval and assignment feat: add Jira workflow and JSM approval actions May 19, 2026
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>
Comment thread pkg/integrations/jira/approve_workflow.go
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>
Comment thread pkg/integrations/jira/client.go Outdated
…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>
Comment thread pkg/integrations/jira/get_workflow.go Outdated
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>
Comment thread pkg/integrations/jira/client.go
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>
Comment thread pkg/integrations/jira/client.go
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>
Comment thread pkg/integrations/jira/approve_workflow.go
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>
Comment thread pkg/integrations/jira/common.go Outdated
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>

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread pkg/integrations/jira/common.go
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 forestileao merged commit 95b0a6c into superplanehq:main Jun 8, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Jira] Add Jira workflow and JSM approval actions

2 participants