GithubHelp home page GithubHelp logo

stevenacoffman / wti Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 12 KB

CLI Utility that tries to get a description of the specified ISSUE from JIRA Cloud

License: MIT License

Makefile 10.12% Go 89.88%
jira git

wti's Introduction

wti - (W)hat (T)he (I)ssue?

Utility that tries to get a description of the specified ISSUE from JIRA Cloud.

git wti TEAM-1234

If the ISSUE is found, by default it will output on one line the Issue Key (TEAM-1234), a dash separator, then the issue summary, followed by the Github Markdown translation of the multi-line issue description.

For example:

ISSUE-1234 โ€” Feature: Make wobulator frobnobicate frabjously.
This is a very important feature that we really want done soon.
It should be extremely well crafted though.

You may suppress output of the first line with --no-title, or suppress output of the multi-line description, with --no-description

Installation

For now, you can run make build from this directory.

Usage

WTI (or git-wti) will use an existing JSON ~/.config/jira config file, or environment variables:

ATLASSIAN_API_TOKEN
ATLASSIAN_HOST
ATLASSIAN_API_USER

The ~/.config/jira file format is:

{"host":"https://khanacademy.atlassian.net","user":"[email protected]","token":"sOmEtOkEn"}

The token must be a JIRA Service Token (see below for directions to obtain one).

Create an API token

Per the Create a JIRA Service Token documentation, create an API token from your Atlassian account:

  1. Log in to https://id.atlassian.com/manage/api-tokens.
  2. Click Create API token.
  3. From the dialog that appears, enter a memorable and concise Label for your token and click Create.
  4. Click Copy to clipboard, then paste the token to your script, or elsewhere to save:
๐Ÿ’ก NOTE: For security reasons it isn't possible to view the token after closing the creation dialog; if necessary, create a new token.
You should store the token securely, just as for any password.
Test an API token

A primary use case for API tokens is to allow scripts to access REST APIs for Atlassian Cloud applications using HTTP basic authentication.

Depending on the details of the HTTP library you use, simply replace your password with the token. For example, when using curl, you could do something like this:

curl -v -L \
https://mycompany.com/rest/api/2/issue/JIRA-116 \
--user $(whoami)@khanacademy.org:${JIRA_API_TOKEN} | jq '{"key": .key, "summary": .fields.summary, "description": .fields.description}'

Note that $(whoami)@khanacademy.org here is intended to be the email address for the Atlassian account you're using to create the token

TODO?

Currently, a JIRA account reference [~accountid:5b4ce9b2dc42b22bc590bd17] will be translated as Bob Froptoppitt ([email protected]). It is unclear if further translating these to Github account mentions would be desirable, since not all JIRA users have Github accounts.

Similarly, the JIRA translation is a little half-baked. If users have pandoc installed, we could shell out to that and use that if it turned out to be better. Making a robust complete translation would require a PEG (Parsing expression grammar).

But that would involve more time than this simple toy maker can find in their weekend.

wti's People

Contributors

stevenacoffman avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.