{"id":49,"date":"2023-10-17T14:30:03","date_gmt":"2023-10-17T21:30:03","guid":{"rendered":"https:\/\/nekton.ai\/blog\/?p=49"},"modified":"2023-10-17T14:32:07","modified_gmt":"2023-10-17T21:32:07","slug":"get-github-pr-statistics-and-custom-reports","status":"publish","type":"post","link":"https:\/\/nekton.ai\/blog\/49-get-github-pr-statistics-and-custom-reports","title":{"rendered":"Get GitHub PR statistics and custom reports"},"content":{"rendered":"\n<p>In this post, we&#8217;ll cover how to get custom reports from GitHub issues, PRs, and commits using Nekton AI and GitHub API.<\/p>\n\n\n\n<p>Let&#8217;s start with a report showing the number of active GitHub PRs per user. It can be useful if you want to find the least busy person to assign a PR to or see who is overloaded on the team.<\/p>\n\n\n\n<p>The final result will look like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"585\" src=\"https:\/\/nekton.ai\/blog\/wp-content\/uploads\/2023\/10\/image-1024x585.png\" alt=\"\" class=\"wp-image-51\" srcset=\"https:\/\/nekton.ai\/blog\/wp-content\/uploads\/2023\/10\/image-1024x585.png 1024w, https:\/\/nekton.ai\/blog\/wp-content\/uploads\/2023\/10\/image-300x171.png 300w, https:\/\/nekton.ai\/blog\/wp-content\/uploads\/2023\/10\/image-768x439.png 768w, https:\/\/nekton.ai\/blog\/wp-content\/uploads\/2023\/10\/image.png 1207w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>You can try it out:<\/p>\n\n\n\n<ul>\n<li><a href=\"https:\/\/nekton.ai\/start\/168-168-n7XUMBJgTfZYJ2NuCfKxFA\" target=\"_blank\" rel=\"noopener\" title=\"Run it out for a public repo\">Run it on a public repo<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/nekton.ai\/app\/workflow\/2295\/clone\" target=\"_blank\" rel=\"noopener\" title=\"Use it on a private repo\">Use it on a private repo<\/a> &#8211; clone this flow and authenticate to GitHub<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">How to make a custom GitHub report<\/h2>\n\n\n\n<p>We start by <a href=\"https:\/\/nekton.ai\/app\/workflow\" target=\"_blank\" rel=\"noopener\" title=\"creating a new workflow in Nekton\">creating a new workflow in Nekton<\/a> and adding a form that asks for the name of the GitHub repo.<\/p>\n\n\n\n<p>After that, I&#8217;ll add an automated step, and describe what needs to be done: &#8220;Create a report of how many active PRs there are for each user of GitHub repo. Format it as a table, and show the least busy users on top.&#8221;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"507\" src=\"https:\/\/nekton.ai\/blog\/wp-content\/uploads\/2023\/10\/image-1-1024x507.png\" alt=\"\" class=\"wp-image-54\" srcset=\"https:\/\/nekton.ai\/blog\/wp-content\/uploads\/2023\/10\/image-1-1024x507.png 1024w, https:\/\/nekton.ai\/blog\/wp-content\/uploads\/2023\/10\/image-1-300x148.png 300w, https:\/\/nekton.ai\/blog\/wp-content\/uploads\/2023\/10\/image-1-768x380.png 768w, https:\/\/nekton.ai\/blog\/wp-content\/uploads\/2023\/10\/image-1.png 1217w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Nekton AI will generate Typescript code to implement this task. It will use GitHub API to get the information about PRs and then format them as a markdown table.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"725\" src=\"https:\/\/nekton.ai\/blog\/wp-content\/uploads\/2023\/10\/image-2-1024x725.png\" alt=\"\" class=\"wp-image-55\" srcset=\"https:\/\/nekton.ai\/blog\/wp-content\/uploads\/2023\/10\/image-2-1024x725.png 1024w, https:\/\/nekton.ai\/blog\/wp-content\/uploads\/2023\/10\/image-2-300x212.png 300w, https:\/\/nekton.ai\/blog\/wp-content\/uploads\/2023\/10\/image-2-768x544.png 768w, https:\/\/nekton.ai\/blog\/wp-content\/uploads\/2023\/10\/image-2.png 1439w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>With AI code generation, I don&#8217;t need to spend an hour learning the API for for one-off small task, and I can get a working automation in less than a minute. Nekton runs this automation in the cloud, and I can share a link to it with other people. You can also review and modify the code before running it.<\/p>\n\n\n\n<p>This automation will work well with public repos, but it wouldn&#8217;t connect to a private one, because it needs authentication. We can add it quite easily by chatting with Nekton AI. I just say &#8220;Authenticate to Github with OAuth&#8221; in the automation chat, and Nekton modifies the code:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"469\" src=\"https:\/\/nekton.ai\/blog\/wp-content\/uploads\/2023\/10\/image-3-1024x469.png\" alt=\"\" class=\"wp-image-56\" srcset=\"https:\/\/nekton.ai\/blog\/wp-content\/uploads\/2023\/10\/image-3-1024x469.png 1024w, https:\/\/nekton.ai\/blog\/wp-content\/uploads\/2023\/10\/image-3-300x137.png 300w, https:\/\/nekton.ai\/blog\/wp-content\/uploads\/2023\/10\/image-3-768x352.png 768w, https:\/\/nekton.ai\/blog\/wp-content\/uploads\/2023\/10\/image-3.png 1244w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>I can then connect this workflow to GitHub using OAuth, and run it for private repos.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Next steps<\/h2>\n\n\n\n<p>You can try running and modding this automation: <a href=\"https:\/\/nekton.ai\/template\/168-pr-statistics-for-git-hub-repo\" target=\"_blank\" rel=\"noopener\" title=\"template for public repo\">template for public repo<\/a>, <a href=\"https:\/\/nekton.ai\/template\/2295-pr-statistics-for-private-git-hub-repo\" target=\"_blank\" rel=\"noopener\" title=\"template for private repo\">template for private repo<\/a>.<\/p>\n\n\n\n<p>You can also try automating your other GitHub day-to-day tasks with Nekton. For example, you can assign PRs to a least busy person, or send this report over email on a schedule.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post, we&#8217;ll cover how to get custom reports from GitHub issues, PRs, and commits using Nekton AI and GitHub API. Let&#8217;s start with a report showing the number of active GitHub PRs per user. It can be useful if you want to find the least busy person to assign a PR to or [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/nekton.ai\/blog\/wp-json\/wp\/v2\/posts\/49"}],"collection":[{"href":"https:\/\/nekton.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nekton.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nekton.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nekton.ai\/blog\/wp-json\/wp\/v2\/comments?post=49"}],"version-history":[{"count":7,"href":"https:\/\/nekton.ai\/blog\/wp-json\/wp\/v2\/posts\/49\/revisions"}],"predecessor-version":[{"id":60,"href":"https:\/\/nekton.ai\/blog\/wp-json\/wp\/v2\/posts\/49\/revisions\/60"}],"wp:attachment":[{"href":"https:\/\/nekton.ai\/blog\/wp-json\/wp\/v2\/media?parent=49"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nekton.ai\/blog\/wp-json\/wp\/v2\/categories?post=49"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nekton.ai\/blog\/wp-json\/wp\/v2\/tags?post=49"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}