• Stars
    star
    604
  • Rank 74,189 (Top 2 %)
  • Language
    Emacs Lisp
  • Created about 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Bring Jira and OrgMode together

org-jira mode

Join the chat at https://gitter.im/org-jira/Lobby MELPA

Use Jira in Emacs org-mode.

Sample of an org-jira buffer with a ticket synced using the org-jira-get-issues-from-custom-jql functionality:

* AHU-Tickets
** TODO [#C] a sample ticket with priority, in my AHU project           :AHU_39:
:PROPERTIES:
:assignee: Matthew Carter
:filename: this-years-work
:reporter: Matthew Carter
:type:     Story
:priority: Medium
:status:   To Do
:created:  2019-01-24T23:24:54.321-0500
:updated:  2021-07-19T18:40:30.722-0400
:ID:       AHU-39
:CUSTOM_ID: AHU-39
:type-id:  10100
:END:
:LOGBOOK:
CLOCK: [2022-02-24 Thu 20:30]--[2022-02-24 Thu 20:35] =>  0:05
  :id: 10359
  Sample time clock entry
:END:
*** description: [[https://example.atlassian.net/browse/AHU-39][AHU-39]]
  The summary is here
*** Comment: Matthew Carter
:PROPERTIES:
:ID:       10680
:created:  2019-01-24T23:25:19.455-0500
:updated:  2019-01-24T23:27:36.125-0500
:END:
  a sample comment on 39

TOC

Table of Contents

Contributing

CONTRIBUTING.md

Setup

Installation

To install, just grab it off of MELPA (ensure your ~/.emacs already has MELPA set up):

(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)

Then run M-x package-install RET org-jira RET and you're done!

Configuration

Create the org-jira-working-dir directory:

(make-directory "~/.org-jira")

In your ~/.emacs, you should set the variable as such:

(setq jiralib-url "https://your-site.atlassian.net")

The first time you try and connect to jira you will be asked for your username and password. Make sure to enter your username and not your email if they are different. If you use two-step verification you will need to create an APItoken and use that instead of your password.

If you don't want to enter your credentials (login/password) each time you go to connect, you can add to your ~/.authinfo.gpg or ~/.authinfo file, in a format similar to:

machine your-site.atlassian.net login [email protected] password yourPassword port 80

Please note that in the authinfo file, port 443 should be specified if your jiralib-url is https.

Usage

Getting Started

org-jira mode is easy to use, to get started (after installing this library) try running M-x org-jira-get-issues. You should see that it pulls in all issues that are assigned to you.

Following that, you can try out some of the org-jira mode commands by visiting one of the files (they're named after your Jira project code, for example, 'EX.org' for a project named 'EX').

Keybinds

Some of the important keybindings:

(define-key org-jira-map (kbd "C-c pg") 'org-jira-get-projects)
(define-key org-jira-map (kbd "C-c ib") 'org-jira-browse-issue)
(define-key org-jira-map (kbd "C-c ig") 'org-jira-get-issues)
(define-key org-jira-map (kbd "C-c ij") 'org-jira-get-issues-from-custom-jql)
(define-key org-jira-map (kbd "C-c ih") 'org-jira-get-issues-headonly)
(define-key org-jira-map (kbd "C-c iu") 'org-jira-update-issue)
(define-key org-jira-map (kbd "C-c iw") 'org-jira-progress-issue)
(define-key org-jira-map (kbd "C-c in") 'org-jira-progress-issue-next)
(define-key org-jira-map (kbd "C-c ia") 'org-jira-assign-issue)
(define-key org-jira-map (kbd "C-c ir") 'org-jira-refresh-issue)
(define-key org-jira-map (kbd "C-c iR") 'org-jira-refresh-issues-in-buffer)
(define-key org-jira-map (kbd "C-c ic") 'org-jira-create-issue)
(define-key org-jira-map (kbd "C-c ik") 'org-jira-copy-current-issue-key)
(define-key org-jira-map (kbd "C-c sc") 'org-jira-create-subtask)
(define-key org-jira-map (kbd "C-c sg") 'org-jira-get-subtasks)
(define-key org-jira-map (kbd "C-c cc") 'org-jira-add-comment)
(define-key org-jira-map (kbd "C-c cu") 'org-jira-update-comment)
(define-key org-jira-map (kbd "C-c wu") 'org-jira-update-worklogs-from-org-clocks)
(define-key org-jira-map (kbd "C-c tj") 'org-jira-todo-to-jira)
(define-key org-jira-map (kbd "C-c if") 'org-jira-get-issues-by-fixversion)

Customization

Get Issues from Custom JQL

You can define one or more custom JQL queries to run and have your results inserted into, as such:

(setq org-jira-custom-jqls
  '(
    (:jql " project IN (EX, AHU) and createdDate < '2019-01-01' order by created DESC "
          :limit 10
          :filename "last-years-work")
    (:jql " project IN (EX, AHU) and createdDate >= '2019-01-01' order by created DESC "
          :limit 10
          :filename "this-years-work")
    (:jql "
project IN (EX, AHU)
and status IN ('To Do', 'In Development')
AND (labels = EMPTY or labels NOT IN ('FutureUpdate'))
order by priority, created DESC "
          :limit 20
          :filename "ex-ahu-priority-items")
    ))

Please note this feature still requires some testing - things that may work in the existing proj-key named buffers (EX.org etc.) may behave unexpectedly in the custom named buffers.

One thing you may notice is if you create an issue in this type of buffer, the auto-refresh of the issue will appear in the PROJ-KEY.org specific buffer (you will then need to refresh this JQL buffer by re-running the command C-c ij).

Streamlined transition flow

You can define your own streamlined issue progress flow as such:

(defconst org-jira-progress-issue-flow
  '(("To Do" . "In Progress"
    ("In Progress" . "Done"))))

or using typical Emacs customize options, as its a defcustom.

This will allow you to quickly progress an issue based on its current status, and what the next status should be.

If your Jira is set up to display a status in the issue differently than what is shown in the button on Jira, your alist may look like this (use the labels shown in the org-jira Status when setting it up, or manually work out the workflows being used through standard C-c iw options/usage):

(defconst org-jira-progress-issue-flow
  '(("To Do" . "Start Progress")
    ("In Development" . "Ready For Review")
    ("Code Review" . "Done")
    ("Done" . "Reopen")))

Basic auth via personal API tokens (secure'ish)

Use a personal API token from here:

https://id.atlassian.com/manage/api-tokens

and your email address from here:

https://id.atlassian.com/manage-profile/email

and you should be able to work with basic auth, even if you are required to auth via Google usually on the browser domain.

Extra basic auth note (thanks @mujo-hash)

For Basic Authentication on cloud Jira, an api token must be used now in place of a password:

https://developer.atlassian.com/cloud/jira/platform/basic-auth-for-rest-apis/

https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/

The self-hosted version of Jira appears to still support Basic Authentication with a user password:

https://developer.atlassian.com/server/jira/platform/basic-authentication/

Using Bearer authentication with Personal Access Tokens

Some JIRA instances might require usage of Authorization headers using Bearer tokens as documented in Using PATs Atlassian documentation.

As documented, PATs should be used without a username in Authorization header as Bearer tokens. Following is an example of using PAT token stored in authinfo to authenticate to JIRA:

(setq jiralib-token
    (cons "Authorization"
          (concat "Bearer " (auth-source-pick-first-password
              :host "jira.company.com"))))

Last Resort Authorization workaround (NOT secure)

However, if all else fails (your Jira instance has disabled basic auth entirely), you can still get in by copying your web browser's cookie. Open up developer console and in the Network tab right click the request for the JIRA page and select 'Copy request as cURL'. Paste it into a file so you can copy out the value for the cookie "cloud.session.token". Then set jiralib-token like this:

(defconst jiralib-token
   '("Cookie" . "cloud.session.token=<YOUR COOKIE VALUE>"))

Optimizations

It's possible some things in your Jira instance rarely if ever change - while org-jira will dynamically query everything as needed, it makes use of some variables/caching per-run of Emacs. If you ever notice something was changed on the Jira setup level, you may have to restart your Emacs (or manually unset these variables). By the same token, that makes it possible to hardcode some of these values yourself, so org-jira never needs to look them up.

Some samples may be:

Optimizing available actions for status changes

Take time inspecting jiralib-available-actions-cache variable as you use org-jira, when you see the type of data it stores, you can then just define it yourself, as such, so repeated usage will not need to re-query the endpoints to get these lists:

(defconst jiralib-available-actions-cache
  '(("To Do"
     ("71" . "Business Question")
     ("11" . "Start Progress"))
    ("Code Review"
     ("71" . "Business Question")
     ("91" . "Reject")
     ("171" . "Failed Peer Review")
     ("221" . "Done"))
    ("In Development"
     ("71" . "Business Question")
     ("21" . "Ready For Review")
     ("81" . "Reject")
     ("161" . "Stop Progress"))
    ("Done"
     ("71" . "Business Question")
     ("141" . "Re-open"))))

About

Maintainer

You can reach me directly: Matthew Carter [email protected], or file an issue here on https://github.com/ahungry/org-jira.

License

GPLv3

More Repositories

1

md4rd

Emacs Mode for Reddit - Read Reddit from within Emacs interactively.
Emacs Lisp
202
star
2

puny-gui

A Puny GUI System
C
98
star
3

awesome-janet

Curated list of awesome Janet things
92
star
4

geben

Geben - PHP xdebug for Emacs
Emacs Lisp
90
star
5

fast-scroll

Emacs package to ensure scrolling remains fast
Emacs Lisp
82
star
6

ahubu

AHUBU Helps Users Be Utilitarian
Clojure
45
star
7

pseudo

Pseudo, a 2.5d multiplayer roguelike
Common Lisp
30
star
8

glyphs

Glyphs - Reducing Common Lisp verbosity
Common Lisp
28
star
9

determinism

all events are determined by previously existing causes
Clojure
22
star
10

prog-fill

Emacs prog-fill functionality (smartly break lines to use vertical space)
Emacs Lisp
20
star
11

color-theme-ahungry

Bright and bold color theme for emacs
Emacs Lisp
17
star
12

ruse

RUSE Userspace System Extensions
Clojure
14
star
13

sluglisp

Like Quicklisp, only slower (a web GUI based Quicklisp for searching the projects)
Common Lisp
13
star
14

ahungry-janet-to-js

Ahungry's Janet to JS Transpiler
Clojure
11
star
15

swagger-to-org

Convert a swagger.json file into an emacs org-mode buffer/file for export to static pdf/html/latex
Emacs Lisp
11
star
16

janet-pobox

Clojure like atoms/spinlocking in Janet
C
9
star
17

janet-code

Tinkering with Janet language
C
8
star
18

pickle-mode

An Emacs major mode for Gherkin (Cucumber) feature files.
Emacs Lisp
8
star
19

ahungry-blog

Blogging in emacs org-mode
Common Lisp
8
star
20

xdg-rc

Library for working with XDG_CONFIG_HOME or other RC locations.
Clojure
7
star
21

language-popularity

Check on language popularity/interest via a simple Common Lisp web app
Common Lisp
7
star
22

ahungry-janet

Ahungry Library for Janet
C
6
star
23

slugelisp

Like sluglisp but for emacs lisp (searching repositories, seeing popularity)
Common Lisp
6
star
24

wilt

WILT - Whitespace Integrated over Lines of Text (A superior alternative to Cyclomatic Complexity checkers)
Awk
6
star
25

ahungry-fleece

Common Lisp minimalist utility library
Common Lisp
6
star
26

metal-mercury-mode

Major mode for editing mercury (prolog type language, http://mercurylang.org) files
Emacs Lisp
6
star
27

geben-helm-projectile

Open geben mode files using helm-projectile
Emacs Lisp
6
star
28

defjs

Code javascript in your Common Lisp REPL and have it evalled in real time
Common Lisp
5
star
29

functional-riemann-client

Riemann Client a little more Functional and a little less OOP
Clojure
4
star
30

p99-patcher

Patcher and map app for the p1999 EQ server
Common Lisp
4
star
31

janet-android

Janet amalgamated build on android
C
4
star
32

injection

Dependency Injection for Common Lisp
Common Lisp
4
star
33

insectarium

An insectarium is a live bug zoo, or a museum or exhibit of live bugs.
Clojure
4
star
34

awesome-bgmods

Awesome BG:EET mods (and maybe some non-EET ones as well!) to centralize great Baldur's Gate/Infinity Engine resources
HTML
3
star
35

com.ahungry

Site code for http://ahungry.com
CSS
3
star
36

bgee-bag-sort

BGEE (Baldur's Gate Enhanced Edition) Bag Sort
JavaScript
3
star
37

baby-gnu

A digital pet to take care of from within emacs
Emacs Lisp
3
star
38

ahungry-map

Map application for project1999 EverQuest Emulator/Server
C++
3
star
39

janet-xbuild

C
2
star
40

typespec

Clojure combination of Spec + Core Typed
Clojure
2
star
41

cl-typed

Strong static typing for Common Lisp
Common Lisp
2
star
42

gui

An attempt to make the most cross-platform and efficient GUI toolbox
Clojure
2
star
43

ahungry-cards

HTML
2
star
44

sdl-blub

Just testing Common Lisp SDL/Opengl
Common Lisp
2
star
45

lack

Simple and streamlined Slack GUI in Yue framework
C++
2
star
46

ahungry-eshop

Messing around with eshop stuff
JavaScript
2
star
47

five-minute-microservices

Five Minute Microservices - A comparison of different language microservices
C
2
star
48

easy-sdk

Easy SDK generation
Prolog
1
star
49

fork-yea

Forking fun in clojure/java/jni/C
Clojure
1
star
50

games-scratch

Just an assortment of godot games/tutorials I'm trying out
GDScript
1
star
51

puny-server

C
1
star
52

aoc-2020

Advent of Code 2020
C
1
star
53

ahungry-manager

Possibly a cross language library/dependency manager.
Common Lisp
1
star
54

janet-p99-map

C
1
star
55

scratch

Random tinkerings
JavaScript
1
star
56

com.ahungry.crypt.jwt

Janet JWT library implemented via the awesome Janetls library
Clojure
1
star
57

magicshieldattack

Magic, Shield, Attack (sort of like rock, paper, scissors!)
GDScript
1
star
58

openldap-alpine

Small sample of openldap on alpine
Dockerfile
1
star
59

postgres-multicorn-restful-api

Sample of a Postgres Multicorn RESTful API Foreign Data Wrapper
Python
1
star
60

diffable

A new website paradigm / idea to try out.
JavaScript
1
star
61

ahungry_heart

BG:EET Mod - The Heart of Baldur's Gate
Janet
1
star
62

docker-dol

Docker file for DOLSharp
Dockerfile
1
star
63

emscripten-tinkering

emscripten-tinkering
C
1
star
64

cl-protobufs

Mirror / fork of cl-protobufs
Common Lisp
1
star
65

puny-lisp

Puny Lisp, the weakest lisp out there!
C
1
star
66

ahungry-around

Wrap an 'around' type function (or any proxy handler) recursively over all user defined functions (nodejs)
JavaScript
1
star
67

lawndart-mode

Major mode for editing dart
Emacs Lisp
1
star
68

emacs-eq-items

Plugin for emacs to quickly allow querying of project1999 item information
Emacs Lisp
1
star
69

com.ahungry.io

Janet I/O things.
C
1
star
70

puny-browser

The puniest browser around using webkit2/gtk3
C
1
star
71

com.ahungry.comments

Ahungry Comments - A free and open alternative to drop and forget for comments.
Clojure
1
star
72

i-made-this

Take an open source project, and make it your own
Shell
1
star
73

parser-combinators

Just toying with them
Prolog
1
star
74

com.ahungry.crypt.aws4

AWS v4 Signature implementation for API interaction using Janetls
Python
1
star
75

slugclojure

An index of useful clojure libs
Common Lisp
1
star
76

j-mode

Major mode for editing J (jsoftware.com) APL files.
Emacs Lisp
1
star
77

ahungry-powerset

A PHP package to generate a power set (enumerate all possible combinations) of a multi-dimensional array
PHP
1
star
78

j-scripts

J APL Scripts
J
1
star
79

ahungry-dm

Display Manager written in Clojure
Clojure
1
star
80

puny-search

The weakest search around!
C
1
star
81

ahungry-tactics

Tactics/card based browser game
JavaScript
1
star
82

annolazy

A lazy way to generate annotations (docblocks) for a project.
PHP
1
star
83

cl-pinner

Pinnable Common Lisp packages from any version control system endpoint
Common Lisp
1
star