Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support to filter by assignee #6

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/jira.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,13 @@
return response.issues ?? raise('Jira.getIssuesByID(): missing issues.');
}

async getIssues(component: string) {
async getIssues(component: string, assignee?: string) {
const dynamicQuery = assignee
? `component = ${component} AND assignee = "${assignee}"`
: `component = ${component}`;

Check warning on line 53 in src/jira.ts

View check run for this annotation

Codecov / codecov/patch

src/jira.ts#L50-L53

Added lines #L50 - L53 were not covered by tests

const response = await this.api.issueSearch.searchForIssuesUsingJqlPost({
jql: `${this.baseJQL} AND component = ${component} ORDER BY id DESC`,
jql: `${this.baseJQL} AND ${dynamicQuery} ORDER BY id DESC`,

Check warning on line 56 in src/jira.ts

View check run for this annotation

Codecov / codecov/patch

src/jira.ts#L56

Added line #L56 was not covered by tests
fields: [
'id',
'issuetype',
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
const issues =
args.length > 0
? await jira.getIssuesByID(args)
: await jira.getIssues(options.component);
: await jira.getIssues(options.component, options.assignee);

Check warning on line 64 in src/main.ts

View check run for this annotation

Codecov / codecov/patch

src/main.ts#L64

Added line #L64 was not covered by tests

const numberOfIssues = issues.length;

Expand Down