Jira Weekly Summary
import logging
import requests
from datetime import datetime, timedelta
import json
from pprint import pprint
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.WARNING)
def format_ticket(ticket):
formatted_ticket = {
"Ticket ID": ticket['id'],
"Key": ticket['key'],
"Summary": ticket['fields']['summary'],
"Status": ticket['fields']['status']['name'],
"Type": ticket['fields']['issuetype']['name'],
"Priority": ticket['fields']['priority']['name'],
"Assignee": ticket['fields']['assignee']['displayName'] if ticket['fields']['assignee'] else "Unassigned",
"Updated": ticket['fields']['updated'],
"Project": ticket['fields']['project']['name'],
}
return formatted_ticket
Created: | Last Updated:
Introduction to the Jira Weekly Summary Template
Welcome to the step-by-step guide on how to use the Jira Weekly Summary template. This template is designed to help you generate a report of all completed Jira tasks within the past week. It will request your Jira domain, email, and API token to access the Jira API and retrieve a list of closed tickets with the status 'Done' that were updated between the start and end of the current week. To get started, simply click "Start with this Template" on the Lazy platform.
External Integrations
Before you can use this template, you need to ensure that you have the following:
- A Jira account with access to the projects you wish to report on.
- An API token from Jira which will be used for authentication. You can generate an API token by following the instructions provided in the Atlassian documentation.
Once you have these details, you will be ready to proceed with using the template.
Using the Test Button and Providing User Input
After clicking "Start with this Template," you will use the Test button to begin the deployment of the app. The Lazy CLI will launch, and you will be prompted to enter the required user input:
- Your Jira domain (e.g., "yourcompany" if your Jira instance is "yourcompany.atlassian.net").
- Your email associated with your Jira account.
- Your Jira API token.
Once you have provided this information, the template will interact with the Jira API to fetch the closed tickets and display them in a formatted manner.
Sample Request and Response
While the template itself does not directly expose an API endpoint, it does make requests to the Jira API. Here is an example of what the request and response might look like:
Sample Request:
This is handled internally by the template, but it essentially performs a GET request to the Jira API with a JQL query to fetch closed tickets.
Sample Response:
The response will be a JSON object containing the details of the closed tickets, which the template will then format and print out. Here's an example of what a single ticket might look like in the output:
```
{ "Ticket ID": "10001", "Key": "PROJ-1", "Summary": "Fix login bug", "Status": "Done", "Type": "Bug", "Priority": "High", "Assignee": "Jane Doe", "Updated": "2023-03-01T12:00:00.000+0000", "Project": "Project Name" }
```
Remember, you do not need to manually make these requests or handle the responses; the template will do this for you once you provide the necessary Jira credentials.
Conclusion
By following these steps, you will be able to use the Jira Weekly Summary template to generate a report of completed tasks in your Jira projects. This tool is designed to simplify your workflow and provide you with valuable insights into your team's progress over the week. If you encounter any issues or have further questions, please reach out for support through the Lazy platform.