1.0.14 • Published 2 years ago
ticket-machine v1.0.14
Ticket machine
This is a tool to generate tickets in JIRA.
Usage
In order to use this library you need API token. Visit https://id.atlassian.com/manage-profile/security/api-tokens and get for yourself API token.
Install package
yarn add ticket-machine
Create a config file
// config.tm.ts
import type { Config } from 'ticket-machine/config';
const config: Config = {
username: () => process.env.USERNAME, // your email address ie. john@example.com
password: () => process.env.PASSWORD, // your token ie. token1234abc
epic: () => process.env.EPIC, // name of the epic where tickets will be created ie. PR-22
project: () => process.env.PROJECT, // name of the project where ticket will be creted, ie. PR
issueType: () => process.env.ISSUETYPE, // type of the issue ie. Story
labels: () => ['front-end'], // labels for the new created ticket
jql: entry => `text ~ "${entry}" AND "Epic Link" = ${process.env.EPIC_ID}`, // Search query that will be executed to make script idempotent
summary: entry => `TODO for ${entry}`, // Title of the ticket
description: entry => `TODO for ${entry}`, // Description of the ticket
transform: () => {
return (entry: Todo, ticket: Issue) => {};
},
};
export default config;
Run command
npx ticket-machine run
How it works?
- It will try login with credentials that you provided
- It will search for ticket with provided
jql
- In case when there is a ticket it will skip ticket creation
- When there is no ticket for given
jql
query it will create ticket
Usage
Ticket machine
Usage:
tm run [--config=<file>]
tm transform [--config=<file>]
tm -h | --help
Options:
-h --help Show this screen.
--config=<file> Config file [default: 'config.tm.ts']
Installation
You need node.js in version 16 and higher, and yarn to run this project. To install dependencies just run:
yarn install
Build
In order to build this library execute:
yarn build
Tests
In order to run test you can simply execute:
yarn test
Linter
We are using ESLint
to check quality of the code.
yarn lint
Prettier
To check if the code is correctly formatted, use prettier
.
yarn prettier
In order to fix files with prettier execute:
yarn prettier:write