Skip to content

Instantly share code, notes, and snippets.

@NeilMasters
Created September 26, 2024 12:28
Show Gist options
  • Save NeilMasters/eb6c5f2a78614d9091e7aad01d6a5682 to your computer and use it in GitHub Desktop.
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
<?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