{"id":21984684,"url":"https://github.com/mrts/ask-jira","last_synced_at":"2025-04-09T23:16:35.958Z","repository":{"id":33307180,"uuid":"36951919","full_name":"mrts/ask-jira","owner":"mrts","description":"Python app that uses the Jira API for aggregate and complex tasks and reports","archived":false,"fork":false,"pushed_at":"2024-11-05T16:50:35.000Z","size":53,"stargazers_count":46,"open_issues_count":5,"forks_count":22,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-09T23:16:33.410Z","etag":null,"topics":["google-calendar","jira","jira-api","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrts.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-06-05T19:41:51.000Z","updated_at":"2025-02-27T20:47:54.000Z","dependencies_parsed_at":"2024-11-29T22:45:29.466Z","dependency_job_id":"fd14b59c-691b-4ce4-8732-f8fc52f3d929","html_url":"https://github.com/mrts/ask-jira","commit_stats":{"total_commits":55,"total_committers":5,"mean_commits":11.0,"dds":0.6363636363636364,"last_synced_commit":"4fd3f735c2e44895e7abe03c1613719e6fc37299"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrts%2Fask-jira","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrts%2Fask-jira/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrts%2Fask-jira/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrts%2Fask-jira/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrts","download_url":"https://codeload.github.com/mrts/ask-jira/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125593,"owners_count":21051771,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["google-calendar","jira","jira-api","python"],"created_at":"2024-11-29T18:10:45.587Z","updated_at":"2025-04-09T23:16:35.938Z","avatar_url":"https://github.com/mrts.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ask-jira\n\nPython app that uses the JIRA API for automated tasks and aggregate or complex reports\nthat are not possible with filters or gadgets in JIRA web UI.\n\nFeatures:\n\n* `export_import_issues_for_jql`: export issues from one JIRA instance to\n  another with comments and attachments (see *Export/import* below)\n\n* `list_epics_stories_and_tasks_for_jql`: print a Markdown-compatible tree\n  of epics, stories and subtasks that match the given JQL query\n\n* `projects`: List available JIRA projects (mainly for testing)\n\n* `fields`: List available JIRA field names and IDs\n\n* `sum_timetracking_for_jql`: Sum original estimate, time spent and time\n  remaining for all issues that match the given JQL query\n\n* `import_worklogs_from_google_calendar`: Import worklog entries from Google\n  Calendar to corresponding JIRA tasks\n\n## Installation\n\n    git clone https://github.com/mrts/ask-jira.git\n\n    cd ask-jira\n\n    python -m venv venv\n    . venv/scripts/activate # when using Git BASH from Git for Windows\n    # . venv/bin/activate # in non-Windows environments\n    pip install --requirement=requirements.txt\n\n    cp jiraconfig-sample.py jiraconfig.py\n\n    # edit jiraconfig.py\n\n    ./ask-jira.py projects # for testing, will print available projects\n\nJIRA server configuration is picked up from `jiraconfig.py`.\n\n## Usage\n\nRun the command with\n\n    $ ./ask-jira.py \u003ccommand\u003e \u003ccommand-specific parameters\u003e\n\nHere's the default help:\n\n    $ ./ask-jira.py\n    usage: ask-jira.py [-h] command\n\n    positional arguments:\n     command   the command to run, available commands:\n               'export_import_issues_for_jql': Export issues from one JIRA instance\n                 to another with comments and attachments\n               'fields': List available JIRA field names and IDs\n               'import_worklogs_from_google_calendar': Import worklog entries from Google Calendar\n                 to corresponding JIRA tasks\n               'list_epics_stories_and_tasks_for_jql': Print a Markdown-compatible tree of epics,\n                 stories and subtasks that match the given JQL query\n               'projects': List available JIRA projects\n               'sum_timetracking_for_jql': Sum original estimate, time spent\n                 and time remaining for all issues that match the given JQL query\n               'transitions': List available JIRA transitions for the given issue\n\n    optional arguments:\n      -h, --help  show this help message and exit\n\n## Examples\n\n    # current sprint velocity\n    ./ask-jira.py sum_timetracking_for_jql 'project = PROJ and sprint in openSprints() and status = Closed'\n\n    ./ask-jira.py list_epics_stories_and_tasks_for_jql 'project = PROJ and type = Epic'\n\n## Export/import\n\nThe `export_import_issues_for_jql` task exports issues from one JIRA instance\nto another with comments, attachments, epics and sub-tasks.\n\nSource JIRA server configuration is picked up from `jiraconfig.py`.\n\nThere is special support for [\"portfolio epics\"](https://www.scaledagileframework.com/epic/),\na SAFe concept. Run `export_import_issues_for_jql` with the `--portfolio-epics`\nflag to enable portfolio epic mode. In portfolio epic mode, the argument JQL\nmust return only top-level portfolio epics and all the linked issues are\nrecursively migrated along with them. See also configuration settings with\n`PORTFOLIO_EPIC` prefix below.\n\nThe task needs special configuration in `exportimportconfig.py` (see sample in\n`exportimportconfig-sample.py`):\n\n* `JIRA`: the target JIRA server configuration where the issues are exported to\n* `PRIORITY_MAP`: map source JIRA priorities to target priorities, e.g. `'Major': 'Medium'`\n* `DEFAULT_PRIORITY`: if source JIRA priority is not found in `PRIORITY_MAP` use this priority (optional)\n* `ISSUETYPE_MAP`: map source JIRA issue types to target issue types,  e.g. `'New Feature': 'Story'`\n* `DEFAULT_ISSUETYPE`: if source JIRA issue type is not found in `ISSUETYPE_MAP` use this issue type (optional)\n* `ASSIGNEE_MAP`: map source JIRA assignees to target assignees\n* `DEFAULT_ASSIGNEE`: if source JIRA issue type is not found in `ASSIGNEE_MAP` use this issue type (optional)\n* `REPORTER_MAP`: map source JIRA reporters to target reporters (usually identical to `ASSIGNEE_MAP`)\n* `DEFAULT_REPORTER`: if source JIRA issue type is not found in `REPORTER_MAP` use this issue type (optional)\n* `SOURCE_EPIC_LINK_FIELD_ID`: ID of the epic field in source JIRA, find it by calling `fields`, look for *Epic Link*\n* `SOURCE_EPIC_NAME_FIELD_ID`: ID of the epic field in source JIRA, find it by calling `fields`, look for *Epic Name*\n* `TARGET_EPIC_NAME_FIELD_ID`: ID of the epic field in **target** JIRA, find it by changing configuration to use target JIRA and calling `fields`, look for *Epic Name*\n* `PORTFOLIO_EPIC_LABEL`: (porfolio epic mode) for an issue to be considered a porfolio epic, this label must be attached to it\n* `PORTFOLIO_EPIC_SUB_EPIC_SOURCE_LINK_NAME`: (porfolio epic mode) only issues that are linked to the portfolio epic with this link name are migrated\n* `PORTFOLIO_EPIC_SUB_EPIC_TARGET_LINK_NAME`: (porfolio epic mode) the link name to use in target JIRA to link issues to portfolio epics\n* `STATUS_TRANSITIONS`: map of source JIRA statuses to list of workflow transition names in target JIRA that result in equivalent status, `None` for no transition\n* `STATUS_TRANSITIONS_ISSUETYPE`: issuetype specific map of source JIRA statuses to list of workflow transition names in target JIRA that result in equivalent status, `None` for no transition. If an issuetype is not in this list, the default `STATUS_TRANSITIONS` are used.\n* `RESOLUTION_MAP`: map source JIRA resolutions to target resolutions, only used when a `WithResolution` transition is used in `STATUS_TRANSITIONS`\n* `CUSTOM_FIELD_FOR_SOURCE_JIRA_ISSUE_KEY`: custom field in target JIRA for saving the source JIRA issue key, **specifying this avoids duplicate imports**, can be `None`\n* `INCLUDE_WORKLOGS`: if `True`, add worklogs from source JIRA issue to the new issue in target JIRA\n* `ADD_COMMENT_TO_OLD_ISSUE`: if `True`, add comment to source JIRA issue that it was exported to new issue in target JIRA with issue link\n* `CUSTOM_FIELD`: a single custom field that you can set to a default value for all issues (set to `None` if not needed)\n* `CUSTOM_FIELD_MAP`: map source JIRA fields to target JIRA fields. This can also be used for system fields that are not mapped out of the box, such as 'environment'\n\nNote that epics and sub-tasks should be excluded from the source JIRA query as\nthey are automatically imported via the parent task. The recommended\nsnippet to add to the query is:\n\n    AND issuetype not in subTaskIssueTypes() AND issuetype != Epic\n\nFull example:\n\n    ./ask-jira.py export_import_issues_for_jql 'project = PROJ\n        AND status not in (Closed, Done, Fixed, Resolved)\n        AND issuetype not in subTaskIssueTypes()\n        AND issuetype != Epic'\n\n## Importing worklogs from Google Calendar\n\nThe `import_worklogs_from_google_calendar` task helps filling JIRA time reports\nfrom Google Calendar events. The Google Calendar events must be formatted\naccording to *JIRA-ID: comment* convention, where *JIRA-ID* is the JIRA issue\nID and *comment* is the comment to add to the worklog. The comment is optional.\nThe script finds the corresponding JIRA issue by ID and adds a worklog with the\nevent duration to it.\n\nIt needs special configuration in `worklogconfig.py` (see sample in\n`worklogconfig-sample.py`, you probably need to change the Google Calendar\ntimezone in `TIMEZONE` and can keep the rest as-is).\n\nYou also need to setup API access to Google Calendar in Google Developers\nConsole as explained [here](https://developers.google.com/google-apps/calendar/quickstart/python#step_1_turn_on_the_api_name).\nBe sure to download the OAuth client secret as instructed and save it to\n`~/.credentials/client_secret.json`.\n\n### Usage\n\nUsage:\n\n    ./ask-jira.py import_worklogs_from_google_calendar -h\n    usage: ask-jira.py [-h] command calendar fromdate todate\n\n    positional arguments:\n      command     import_worklogs_from_google_calendar\n      calendar    the calendar name to import worklogs from\n      fromdate    import date range start, in yyyy-mm-dd format\n      todate      import date range end, in yyyy-mm-dd format\n\nFull example:\n\n    ./ask-jira.py import_worklogs_from_google_calendar 'Timereport' 2017-02-23 2017-02-24\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrts%2Fask-jira","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrts%2Fask-jira","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrts%2Fask-jira/lists"}