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

fix issue creation #7

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion example-config.edn
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
; Jira username (might be something like "flastname").
:assignee #env USER
; Type of issue to create.
:issue-type "Task"
Copy link
Owner

Choose a reason for hiding this comment

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

there is code that uses this value as issue-type: https://github.com/rwstauner/jirazzz/blob/main/jirazzz#L209-L217
so changing the spelling here without changing that code means it will never find an issue type from the createmeta response.

:type-id "Task"
; Pattern to look for in commit messages. Should have single capture group.
:issue-pattern "\\[([A-Z]+-[0-9]+)\\]"
; A selmer template for how to add issue to commit messages.
Expand Down
4 changes: 2 additions & 2 deletions jirazzz
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@
{:json {:fields (merge
(select-keys opts [:summary
:description])
{:project {:id (:project-id opts)}
:issuetype {:id (:type-id opts)}
{:project {:key (:project-id opts)}
Copy link
Owner

Choose a reason for hiding this comment

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

https://docs.atlassian.com/software/jira/docs/api/REST/9.1.1/#api/2/issue-createIssue

This api doc still shows that id is the parameter for the request.
It is spelled key in the response.
(These are request parameters).

:issuetype {:name (:type-id opts)}
Copy link
Owner

Choose a reason for hiding this comment

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

type-id is generated from get-meta:
https://github.com/rwstauner/jirazzz/blob/main/jirazzz#L209-L217

The issue-type configuration string is used to identify the correct issuetype from the meta response: https://github.com/rwstauner/jirazzz/blob/main/test/jirazzz/test_util.clj#L137-L147

If type-id was just the string from the config, it wouldn't be a map (so passing it to :name would return nil).

It's possible that at this point type-id was nil because the issue-type in the config didn't find a match in the project response.

Copy link
Owner

Choose a reason for hiding this comment

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

If for some reason createmeta isn't returning an issuetype that you want to use anyway, we could probably tweak the get-meta code to not overwrite type-id if issue-type wasn't provided. That way a type-id in the config would pass through.

From what I know about Jira, however, trying to create an issue with a type that isn't included in the createmeta response will likely be rejected anyway.

:assignee {:name (jira-user opts :assignee)}}
(custom-fields opts))}})
ky (:key response)
Expand Down