Skip to content

Commit cbe2297

Browse files
authored
Jira - Search for issues using JQL (#16642)
* search-issues-with-jql * pnpm-lock.yaml
1 parent 7135567 commit cbe2297

File tree

2 files changed

+125
-1
lines changed

2 files changed

+125
-1
lines changed
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
import jira from "../../jira.app.mjs";
2+
3+
export default {
4+
name: "Search Issues with JQL",
5+
description: "Search for issues using JQL (Jira Query Language). [See the documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search/#api-rest-api-3-search-jql-get)",
6+
key: "jira-search-issues-with-jql",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
jira,
11+
cloudId: {
12+
propDefinition: [
13+
jira,
14+
"cloudId",
15+
],
16+
},
17+
jql: {
18+
type: "string",
19+
label: "JQL Query",
20+
description: "The [JQL](https://support.atlassian.com/jira-software-cloud/docs/what-is-advanced-search-in-jira-cloud/) query to search for issues",
21+
},
22+
maxResults: {
23+
type: "integer",
24+
label: "Max Results",
25+
description: "Maximum number of issues to return (default: 50, max: 100)",
26+
optional: true,
27+
default: 50,
28+
min: 1,
29+
max: 100,
30+
},
31+
fields: {
32+
type: "string",
33+
label: "Fields",
34+
description: "Comma-separated list of fields to return for each issue",
35+
default: "*all",
36+
optional: true,
37+
},
38+
expand: {
39+
type: "string[]",
40+
label: "Expand",
41+
description: "Use expand to include additional information about the issues in the response",
42+
optional: true,
43+
options: [
44+
{
45+
label: "Returns field values rendered in HTML format",
46+
value: "renderedFields",
47+
},
48+
{
49+
label: "Returns the display name of each field",
50+
value: "names",
51+
},
52+
{
53+
label: "Returns the schema describing a field type",
54+
value: "schema",
55+
},
56+
{
57+
label: "Returns all possible transitions for the issue",
58+
value: "transitions",
59+
},
60+
{
61+
label: "Returns information about how each field can be edited",
62+
value: "editmeta",
63+
},
64+
{
65+
label: "Returns a list of recent updates to an issue, sorted by date, starting from the most recent",
66+
value: "changelog",
67+
},
68+
{
69+
label: "Returns a JSON array for each version of a field's value, with the highest number representing the most recent version",
70+
value: "versionedRepresentations",
71+
},
72+
],
73+
},
74+
properties: {
75+
type: "string",
76+
label: "Properties",
77+
description: "A list of up to 5 issue properties to include in the results. This parameter accepts a comma-separated list.",
78+
optional: true,
79+
},
80+
fieldsByKeys: {
81+
type: "boolean",
82+
label: "Fields by Keys",
83+
description: "Reference fields by their key (rather than ID). The default is `false`.",
84+
optional: true,
85+
},
86+
failFast: {
87+
type: "boolean",
88+
label: "Fail Fast",
89+
description: "Fail this request early if we can't retrieve all field data",
90+
optional: true,
91+
},
92+
},
93+
methods: {
94+
searchIssues(args = {}) {
95+
return this.jira._makeRequest({
96+
path: "/search/jql",
97+
...args,
98+
});
99+
},
100+
},
101+
async run({ $ }) {
102+
try {
103+
const response = await this.searchIssues({
104+
$,
105+
cloudId: this.cloudId,
106+
params: {
107+
jql: this.jql,
108+
maxResults: this.maxResults,
109+
fields: this.fields,
110+
expand: this.expand
111+
? this.expand.join(",")
112+
: undefined,
113+
properties: this.properties,
114+
fieldsByKeys: this.fieldsByKeys,
115+
failFast: this.failFast,
116+
},
117+
});
118+
$.export("$summary", `Successfully retrieved ${response.issues.length} issues`);
119+
return response;
120+
} catch (error) {
121+
throw new Error(`Failed to search issues: ${error.message}`);
122+
}
123+
},
124+
};

components/jira/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/jira",
3-
"version": "0.1.4",
3+
"version": "0.2.0",
44
"description": "Pipedream Jira Components",
55
"main": "jira.app.mjs",
66
"keywords": [

0 commit comments

Comments
 (0)