Skip to content

Instantly share code, notes, and snippets.

@jdhitsolutions
Last active April 7, 2024 11:39
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdhitsolutions/36f16e9b2d89353cfa93edc8e4b5b3c3 to your computer and use it in GitHub Desktop.
Save jdhitsolutions/36f16e9b2d89353cfa93edc8e4b5b3c3 to your computer and use it in GitHub Desktop.
PowerShell Podcast Scripting Challenge

PowerShell Podcast ScriptingChallenge

This is the PowerShell scripting challenge from my appearance on the PowerShell Podcast

Base Challenge

Using whatever tools and techniques you want, write a PowerShell function that will query the Issues section of a GitHub repository and create output showing the number of open issues by label and the percentage of all open issues. Remember that multiple labels may be used with an issue.

For example, if there are 54 open issues and the bug label is used 23 times,your output would show a count of 23 and a total percentage of 42.59 for the bug label.

The function should work for any GitHub repository, but test it with the PowerShell repository. Naturally, the function should follow community accepted best practices, have parameter validation, and proper error handling.

Bonus Challenges

Once you have the function, add custom formatting to display the results in a table, including the repository name or path.

Create an alternative view that will also display the repository and the label URI that GitHub uses to create a filtered page view.

Finally, create a control script using the function to create a markdown report for the PowerShell repository showing the top 25 labels. The markdown report should have clickable links.

You will most likely end up with several files to meet all the challenge requirements.

Hint: There's more than one way to access the GitHub API.

To Participate

We hope many people will test their skills with this challenge. You are encouraged to post a comment with a link to your solution. Please do not post your solution. In about 4-6 weeks, I will post my solutions. There is no single correct solution to this challenge and the goal is to have fun and learn something new along the way.

Happy Scripting!

@SamErde
Copy link

SamErde commented Jan 2, 2024

Fun idea for a challenge! Unfortunately/fortunately, I had no computer for my entire holiday vacation and this month is looking busy. Look forward to trying as well as to seeing the solutions people come up with.

@Ayanmullick
Copy link

Ayanmullick commented Jan 3, 2024

@jdhitsolutions
Copy link
Author

Here's a ChatGPT response via Doug Finke. https://chat.openai.com/share/40ce5107-09c6-4209-93b5-93399ae55839

@DwayneGibbs
Copy link

DwayneGibbs commented Feb 16, 2024

I like that ChatGPT response Jeff. However, the function, when used with the PowerShell repository, is only returning 30 issues and then performing the calculations. Those counts returned with the following results of which some share the same label.

Label Count Percentage
Small 1 3.33
Issue-Enhancement 8 26.67
In-PR 1 3.33
CL-CodeCleanup 1 3.33
WG-Language 1 3.33
Extra Small 9 30.00
WG-NeedsReview 1 3.33
CommunityDay-Small 1 3.33
Review - Needed 3 10.00
WG-Cmdlets 1 3.33
CL-BuildPackaging 1 3.33
Needs-Triage 20 66.67

I believe we'd need to look at all Open Issues of which at the time of this request is 801.

@deadlydog
Copy link

deadlydog commented Feb 28, 2024

Here's my implementation. This was a fun challenge. Thanks!


Open Issues Label Stats For PowerShell/PowerShell

Repository: PowerShell/PowerShell

Total number of open issues: 918

Total number of labels: 81

Open Issues By Label

Note: Only the top 25 labels are shown here.

Label Number of Open Issues Percentage of Open Issues
Needs-Triage 510 55.56%
Issue-Enhancement 303 33.01%
WG-Engine 123 13.4%
Review - Needed 111 12.09%
Issue-Bug 88 9.59%
Up-for-Grabs 71 7.73%
WG-Cmdlets 67 7.3%
WG-Cmdlets-Utility 62 6.75%
Extra Small 56 6.1%
In-PR 55 5.99%
WG-Language 48 5.23%
WG-NeedsReview 44 4.79%
WG-Cmdlets-Management 44 4.79%
Issue-Discussion 34 3.7%
WG-Cmdlets-Core 34 3.7%
Issue-Question 33 3.59%
WG-Reviewed 30 3.27%
CL-General 25 2.72%
WG-Interactive-Console 24 2.61%
Area-FileSystem-Provider 24 2.61%
Area-Maintainers-Build 22 2.4%
Committee-Reviewed 22 2.4%
WG-Engine-Providers 22 2.4%
PowerShell-Docs not needed 21 2.29%
PowerShell-Docs needed 17 1.85%

@jdhitsolutions
Copy link
Author

I wrote about my solution here

Label Report for powershell/powershell

This is the breakdown of labels based on 813 open issues. Total percentages might be more than 100% as issues can have multiple labels.

Count Percent of Total Label
503 61.87 Needs-Triage
302 37.15 Issue-Enhancement
114 14.02 WG-Engine
88 10.82 Issue-Bug
71 8.73 Up-for-Grabs
62 7.63 WG-Cmdlets
61 7.5 WG-Cmdlets-Utility
54 6.64 In-PR
45 5.54 WG-Language
43 5.29 WG-Cmdlets-Management
36 4.43 WG-NeedsReview
34 4.18 WG-Cmdlets-Core
33 4.06 Issue-Question
33 4.06 Issue-Discussion
25 3.08 WG-Reviewed
24 2.95 Area-FileSystem-Provider
22 2.71 Area-Maintainers-Build
20 2.46 WG-Interactive-Console
20 2.46 WG-Engine-Providers
19 2.34 Committee-Reviewed
15 1.85 KeepOpen
15 1.85 Distribution-Request
11 1.35 Needs-Investigation
10 1.23 WG-Security
10 1.23 WG-Interactive-HelpSystem
9 1.11 WG-Remoting
9 1.11 WG-Interactive-IntelliSense
8 0.98 WG-Engine-Module
8 0.98 Review - Maintainer
7 0.86 WG-Engine-Performance
7 0.86 OS-Linux
7 0.86 Area-Maintainers-Documentation
6 0.74 WG-Triaged
6 0.74 WG-Engine-Format
6 0.74 Hacktoberfest
6 0.74 Breaking-Change
5 0.62 WG-DevEx-Portability
5 0.62 OS-Windows
5 0.62 OS-macOS
4 0.49 WG-Engine-ParameterBinder
4 0.49 Waiting - DotNetCore
3 0.37 WG-Interactive-Debugging
3 0.37 Resolution-By Design
3 0.37 Issue-Meta
3 0.37 Documentation Needed in this repo
3 0.37 Area-PowerShellGet
2 0.25 WG-Interactive-PSReadLine
2 0.25 WG-DevEx-SDK
2 0.25 RFC-Required
2 0.25 Resolution-No Activity
2 0.25 Package-MSIX
2 0.25 OS-WSL
2 0.25 Needs-Repro
2 0.25 Issue-Code Cleanup
2 0.25 Area-DSC
1 0.12 WG-Quality-Test
1 0.12 WG-Engine-Pipeline
1 0.12 Resolution-Declined
1 0.12 Release-Testing
1 0.12 PowerShell-Docs needed
1 0.12 Issue-Regression
1 0.12 Hacktoberfest-Accepted
1 0.12 CL-Test
1 0.12 7.4-regression

03/07/2024 13:55:36

@pauljnav
Copy link

pauljnav commented Apr 7, 2024

Hi @jdhitsolutions / all,
Heres my solution.
Im late to this challenge but would appreciate feedback especially as I took the GitHub API approach (unauthenticated and rate-limited)
Paul

LabelCountPercent
Needs-Triage51855.52%
Issue-Enhancement30833.01%
WG-Engine12112.97%
Review - Needed11412.22%
Issue-Bug849.00%
Up-for-Grabs717.61%
WG-Cmdlets697.40%
WG-Cmdlets-Utility606.43%
Extra Small586.22%
In-PR576.11%
WG-NeedsReview515.47%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment