diff --git a/project/JIRA_cloud_connect.py b/project/JIRA_cloud_connect.py index dfd4445..4d4faa4 100644 --- a/project/JIRA_cloud_connect.py +++ b/project/JIRA_cloud_connect.py @@ -18,4 +18,17 @@ user = jira.username if user: print(f'Connected to JIRA as: {user}') else: - print('Failed to connect to JIRA') \ No newline at end of file + print('Failed to connect to JIRA') + +# Define a JQL query to fetch one JIRA ticket +jql_query = 'created >= -30d order by created DESC' # Adjust the JQL query as needed +max_results = 1 # Limit the results to one ticket + +# Fetch the ticket(s) using the JQL query +tickets = jira.jql(jql_query, limit=max_results) + +if tickets and tickets.get('issues'): + ticket = tickets['issues'][0] + print(f"Fetched JIRA ticket: {ticket['key']} - {ticket['fields']['summary']}") +else: + print('No tickets found or failed to fetch tickets') \ No newline at end of file