Skip to content

jira-list list on console all issues assigned on jira #409

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

Open
wants to merge 1 commit into
base: master
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
21 changes: 21 additions & 0 deletions scripts/jira-list/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## Description:

List issues from jira assigned to you on the console

![Image list-jira](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/unwm4dmza9p3d6cd3v4g.png)

## Configure

add to ~/.bashrc

```
export JIRA_API_TOKEN=""
export JIRA_USER=""
export JIRA_URL="https://myjira.atlassian.net/"
```

use the api token from jira: https://id.atlassian.com/manage-profile/security/api-tokens

## Install
pip install jira colorama

49 changes: 49 additions & 0 deletions scripts/jira-list/jira-list
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/env python
"""

use the api token from jira: https://id.atlassian.com/manage-profile/security/api-tokens

# add to ~/.bashrc
export JIRA_API_TOKEN=""
export JIRA_USER=""
export JIRA_URL="https://myjira.atlassian.net/"

# install
pip install jira colorama

"""
from jira import JIRA
import os
import subprocess
import re
from colorama import Fore, Back, Style
import argparse


token = os.environ.get("JIRA_API_TOKEN")
user = os.environ.get("JIRA_USER")
jira_url = os.environ.get("JIRA_URL")

jira = JIRA(server=jira_url, basic_auth=(user, token))

def main(args):
if args.summary:
result = jira.issue(args.summary, fields='description')
print(f"{result.fields.description or ''}")
return
result = jira.search_issues(""" (assignee = currentUser()) and statuscategory IN ("In Progress","New") ORDER BY updated""")
for j in result:
if args.title:
print(f"{j.key} {j.fields.summary}")
elif args.link:
print(f"{j.key} {j.permalink()}")
else:
print(f"{j.key} {j.fields.assignee} {Fore.LIGHTWHITE_EX} {j.fields.status} {Fore.CYAN}{j.fields.summary} {Fore.RESET}{j.permalink()} ")

if __name__ == "__main__":
parser = argparse.ArgumentParser(description='List jira issues .. made by zodman')
parser.add_argument("-t","--title",help="only show ID and title", action="store_true")
parser.add_argument("-l","--link",help="show only links", action="store_true")
parser.add_argument("-s","--summary",help="show sumary")
args = parser.parse_args()
main(args)