What I built
A Jupyter Notebook that will allow you to count issues that have been applied a specific label week on week, for a number of weeks that you choose.
This is particularly useful if you use a specific label to triage issues e.g. "triaged". You can then see how many issues were triaged week on week and by whom.
Category Submission:
Maintainer Must-Haves
App Link
You can try it directly in GitHub Codespaces.
Screenshots
Description
This Python script is used to count the number of issues in a specific GitHub repository that have been labeled with a specific label within a given number of weeks. The script uses the GitHub API to fetch and process the repository's issues.
Here's a breakdown of what each function in the script does:
get_start_of_week()
: returns the datetime object of the start of the current week (Monday at 00:00:00).get_total_issues(repo_owner, repo_name, access_token, label)
: returns the total number of issues in the given repository with the given label. It does this by sending a GET request to the GitHub API's search endpoint.count_labelled_issues(repo_owner, repo_name, access_token, label, weeks)
: main function of the script. It counts the number of issues in the given repository that have been labeled with the given label within the given number of weeks. It does this by sending a GET request to the GitHub API's issues endpoint, then iterating over the response data and counting the number of issues that meet the criteria. The function also prints a report for each week, listing the issues that were labeled during that week, their titles, their URLs, and the user who labeled them. I also included closed issues in the output.
The script uses the colorama library to print coloured text to the console (it doesn't show in the Jupyter Notebook version).
Link to Source Code
https://github.com/plopcas/labelled-issues-jupyter
Permissive License
MIT license
Background (What made you decide to build this particular app? What inspired you?)
Trying to gather metrics for triaging process. GitHub doesn't make it obvious to work with events like "labeled". This script allows me to generate metrics week on week.
How I built it (How did you utilise GitHub Actions or GitHub Codespaces? Did you learn something new along the way? Pick up a new skill?)
I used GitHub Codespaces with the Jupyter Notebook template which allowed me to very quickly test the functionality as I was building it.
Top comments (0)