This is an Templater userscript to store jira ticket data as Obsidian note. Discussion is here.
This template requires go-jira tool to be installed and configured and provides three ways to load jira issues:
- Inserting ticket contents for prompted issue id
- Inserting ticket contents extracting issue id from note title
- Inserting current active sprint overview note and populating its tasks as separate documents
- Install go-jira tool
- Configure go-jira to work with your jira server
- Create
~/.jira.d/config.yml
file, example contents:endpoint: https://jira.example.com/ user: username project: TEST
- Execute
jira login
to check configuration and retrieve cookies
- Create
- Install Templater plugin
- Configure Templater
- Set
Template folder location
- Set
Script files folder location
- Turn on
Enable System Comands
option - Optionally set
Shell binary location
to/bin/sh
- Add
jira
user function with valuejira view -t debug $id
- Optionally (for sprint template support) add user function
jira_tasks
with valuejira list -t debug -q 'assignee = currentUser() AND Sprint in openSprints() AND Sprint not in futureSprints()'
- Set
- Place this template's
.js
(scripts_*.js
) and.md
(templates_*.md
) files without prefixes (e.g.scripts_j2m.js
goes to<Scripts>/j2m.js
andtemplates_Expand Jira Issue.md
goes to<Templates/>Expand Jira Issue.md
) into configured TemplaterScript
andTemplate
directories respectively
Use Templater Insert Template
(Alt + E
) command to insert one of templates.
If script fails to load data, try running jira login
from terminal to update your cookies.
Feel free to modify any part of template to suit your needs. You might want to add your jira installation specific fields like Estimation
which are usually named as customfield_11111
. Use jira -t denug
to explore issue hierarchy.
Sprint template uses clumsy logic to compute sprint number in form of y<YEAR>q<QUARTER>s<SPRINT>
assuming two weeks sprints. Tune it the way you want it to work.
---
starts_at: Mon Dec 20 2021 00:00:00 UTC
ends_at: Mon Jan 03 2022 00:00:00 UTC
issues: 2
points: 7
name: y21q4s6
tags:
- work
- sprint
- y21q4
---
# Sprint y21q4s6
## TODO
* [ ] [[ISSUE-11111]] Issue title [2 sp](https://jira/browse/ISSUE-11111)
* [ ] [[ISSUE-22222]] Issue title [5 sp](https://jira/browse/ISSUE-22222)
## In progress
## Done
---
issue: ISSUE-11111
url: https://jira/browse/ISSUE-11111
priority: Normal
points: 5
reporter: First Last (@username)
assignee: First Last (@username)
created_at: Wed Dec 15 2021 12:00:00 UTC
tags:
- work
- issue
- y21q4
---
# [ISSUE-11111](https://jira/browse/ISSUE-11111) Issue title
Markdown formatted issue description goes here
## Worklog
*
Copyright (c) 2021 Sergey Poryvaev
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Making
issue.js
prompt user for inputI wanted to be able to insert an issue into a current note, so I came up with this:
Replace lines 102-110 with:
I compliment that by replacing lines 94-97 with
input = lines.join('\n')
to get rid of that last new line and making the output to something a little more minimal: