Created
September 26, 2024 12:28
-
-
Save NeilMasters/eb6c5f2a78614d9091e7aad01d6a5682 to your computer and use it in GitHub Desktop.
Generic Jira issues script for pulling a JQL list of issues based on type and sprint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include('vendor/autoload.php'); | |
$sprint = $argv[1]; | |
$email = ''; | |
$token = ''; | |
$domain = ''; | |
$project = ''; | |
$type = ''; | |
/** | |
* Get your API Token from /manage-profile/security/api-tokens | |
*/ | |
Unirest\Request::auth($email, $token); | |
$response = Unirest\Request::get( | |
sprintf('https://%s.atlassian.net/rest/api/3/search', $domain), | |
['Accept' => 'application/json',], | |
[ | |
'jql' => sprintf( | |
'project = "%s" AND "Type of Work" = "%s" AND Sprint = "%s"', | |
$project, | |
$type, | |
$sprint | |
) | |
] | |
); | |
foreach ($response->body->issues as $issue) { | |
echo sprintf( | |
'"%s", "%s", "%s" %s', | |
$issue->key, | |
$issue->fields->assignee->displayName, | |
sprintf('%s minutes', $issue->fields->aggregatetimespent / 60), | |
PHP_EOL | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment