Skip to content

Commit

Permalink
Merge pull request #17 from JohnStrunk/scratch
Browse files Browse the repository at this point in the history
Update scratch notebooks
  • Loading branch information
mergify[bot] authored Apr 25, 2024
2 parents 96a5336 + d65f92b commit c1a9273
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 6 deletions.
80 changes: 74 additions & 6 deletions jira_howto.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@
"# Lets look at all the possible Jira fields and their types:\n",
"fields = jira.get_all_fields()\n",
"for field in sorted(fields, key=lambda x: x['id']):\n",
" type = field['schema']['type'] if 'schema' in field else 'unknown'\n",
" print(f\"{field['id']} -> {field['name']} -- {type}\")"
" ftype = field['schema']['type'] if 'schema' in field else 'unknown'\n",
" print(f\"{field['id']} -> {field['name']} -- {ftype}\")"
]
},
{
Expand Down Expand Up @@ -254,7 +254,7 @@
},
"outputs": [],
"source": [
"pprint(jira.issue('OCTO-2'))"
"pprint(jira.issue('OCTO-2', fields='key,updated'))"
]
},
{
Expand All @@ -276,9 +276,77 @@
},
"outputs": [],
"source": [
"result = jira.jql(\"labels = 'AISummary' ORDER BY updated DESC\", limit=50, fields=\"key,updated\")\n",
"keys = [x['key'] for x in result['issues']]\n",
"pprint(keys)"
"from datetime import datetime\n",
"dt = datetime.fromisoformat('2024-04-20T13:02:00.000+0000')\n",
"result = jira.jql(f\"labels = 'AISummary' and updated > \\\"{dt.strftime(\"%Y-%m-%d %H:%M\")}\\\" ORDER BY updated DESC\", limit=50, fields=\"key,updated\")\n",
"keys = [(x['key'], datetime.fromisoformat(x['fields']['updated'])) for x in result['issues']]\n",
"pprint(keys)\n",
"print(type(result))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"# With a private comment\n",
"pprint(jira.issue('OHSS-34055'))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Private comments have: `comment['visibility'] = {'type': 'group', 'value': 'Red Hat Employee'}`\n",
"\n",
"Otherwise, they do not have the visibility key."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"jira.get_project('RHSTOR')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"jira.get_project('STOR')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"jira.get_project('OCTOET', expand='all')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"jira.get_project_permission_scheme('OCTOET', expand='permissions,user,group,projectRole,field')"
]
}
],
Expand Down
68 changes: 68 additions & 0 deletions summ.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"# Create a JIRA client\n",
"from os import environ\n",
"from atlassian import Jira\n",
"jira_api_token = environ.get('JIRA_TOKEN', '')\n",
"jira_url = environ.get('JIRA_URL', '')\n",
"jira = Jira(url=jira_url, token=jira_api_token)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"import summarizer\n",
"import importlib\n",
"\n",
"# Reload the 'summarizer' module\n",
"importlib.reload(summarizer)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"from datetime import datetime\n",
"summarizer.get_issues_to_summarize(jira, datetime.fromisoformat('2024-04-19'))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

0 comments on commit c1a9273

Please sign in to comment.