Programatically create jira issues from Github
- The code leverages
atlassian-python-api
sdk along with python to create jira issues likeTask (Story)
,Sub Task
,Epic
Argument | Description | Mandatory or not |
---|---|---|
type_of_issue | Type of issue like Epic, sub task or story (Task) | ✅ |
jira_board | In which Jira board you want to create issues | ✅ |
epic_key | Epic id if story needs to be attached | ❌ |
summary | Issue summary | ✅ |
description | Issue description | ✅ |
story_key | Jira story key to attach sub task | ❌ |
-
Clone the repository:
git clone <repository-url> cd <repository-directory>
-
Install the required Python packages:
- If poetry is not installed locally, do
pip install poetry
then,
poetry install
have a look here - https://python-poetry.org/
- If poetry is not installed locally, do
-
Create a
.env
file in the root directory and add your Jira credentials:JIRA_URL=<your-jira-url> JIRA_USERNAME=<your-jira-username> JIRA_PASSWORD=<your-jira-password>
To run the script, use the following command:
python <script_name>.py --type_of_issue <issue_type> --jira_board <board_key> --summary <issue_summary> --description <issue_description> [--epic_key <epic_key>] [--story_key <story_key>]
Create an Epic:
python create_jira_issue.py --type_of_issue Epic --jira_board BOARD_KEY --summary "Epic Summary" --description "Epic Description"
Create a Task under an Epic:
python create_jira_issue.py --type_of_issue Task --jira_board BOARD_KEY --epic_key EPIC_KEY --summary "Task Summary" --description "Task Description"
Create a Subtask under a Task:
python create_jira_issue.py --type_of_issue Subtask --jira_board BOARD_KEY --story_key STORY_KEY --summary "Subtask Summary" --description "Subtask Description"