Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Tracking pull request time in draft state #415

Merged
merged 15 commits into from
Oct 24, 2024
Merged

Conversation

zkoppert
Copy link
Member

@zkoppert zkoppert commented Oct 23, 2024

Pull Request

fixes #353

Proposed Changes

This pull request introduces a new feature to track the time pull requests (PRs) spend in draft mode and includes various updates to the codebase to support this functionality. The most important changes include updates to the README.md for documentation, modifications to the IssueWithMetrics class, and updates to the config.py and issue_metrics.py files to handle the new draft PR tracking feature. PR's that bypass draft mode report results as None.

Readiness Checklist

Author/Contributor

  • If documentation is needed for this change, has that been included in this pull request
  • run make lint and fix any issues that you have introduced
  • run make test and ensure you have test coverage for the lines you are introducing
  • If publishing new data to the public (scorecards, security scan results, code quality results, live dashboards, etc.), please request review from @jeffrey-luszcz

Reviewer

  • Label as either fix, documentation, enhancement, infrastructure, maintenance, or breaking

Example Markdown Output

Issue Metrics

Metric Average Median 90th percentile
Time to first response 4:12:27 0:08:15 6:46:59
Time to close 9:20:13 0:58:37 1 day, 1:01:31
Time in draft 3:17:41 0:04:50 9:47:12
Metric Count
Number of items that remain open 0
Number of items closed 24
Number of most active mentors 0
Total number of items created 24
Title URL Author Time to first response Time to close Time in draft
feat: add bypass to rate limiter #396 zkoppert 2 days, 5:21:02 2 days, 12:42:29 0:04:16
chore: Remove unneeded pip install #393 zkoppert 0:00:35 0:02:24 None
docs: Add OSSF Best Practices Badge #392 zkoppert 1:24:08 1:24:24 None
chore: use setup python to improve OSSF scorecard #391 zkoppert 0:53:00 0:53:14 0:43:01
Dont merge, testing #386 zkoppert None None None
fix: Remove more general part of duplicate actions permissions #382 zkoppert 0:01:08 0:58:37 0:00:29
fix: Remove ignore_users authored items from markdown results #379 zkoppert 0:01:52 0:02:49 0:05:25
fix: Catch review comments with no valid user #326 zkoppert 0:00:53 0:33:51 None
fix: catch error that occurs when ghost usre creates an event. #325 zkoppert 0:01:35 7:03:38 None
chore: pin shas in Dockerfile #315 zkoppert 0:08:15 0:14:39 None
feat: Add option to hide Number of items closed metric #313 zkoppert 0:02:29 1 day, 0:48:49 0:01:31
fix: issue counts incorrect when HIDE_TIME_TO_CLOSE is True #311 zkoppert 15:12:32 1 day, 19:34:15 None
chore: add Jacob to pr reviews automatically #304 zkoppert 0:02:36 0:03:24 None
ci: Add Jeff to review new data releases #298 zkoppert 0:02:17 0:09:52 None
ci: release when a new feature hits main #296 zkoppert 0:02:03 0:05:46 None
chore: Switch to weekly dep updates to reduce noise #278 zkoppert 1:35:16 1:40:57 None
feat: Split markdown files when larger than max issue body size #265 zkoppert 0:34:16 1 day, 1:04:42 None
fix: handle multiple repos in search query #261 zkoppert 4:40:36 17:13:18 None
fix: Performance fix to only measure statistics which are not hidden #239 zkoppert 1:07:24 23:08:08 None
switch to v3 #223 zkoppert 0:44:33 4:08:46 18:51:23
Update CODEOWNERS #220 zkoppert None 0:06:37 None
Use keep label to exempt issues from stale action #216 zkoppert None 0:05:00 None
Create stale.yaml #214 zkoppert None 2:29:51 None
Update issue creation action version #201 zkoppert None 0:09:39 None

This report was generated with the Issue Metrics Action
Search query used to find these items: repo:github/issue-metrics is:pr author:zkoppert created:2024-01-01..2024-10-14

Example json output

{
    "average_time_to_first_response": "4:12:27",
    "average_time_to_close": "9:20:13",
    "average_time_to_answer": "None",
    "average_time_in_draft": "3:17:41",
    "average_time_in_labels": {},
    "median_time_to_first_response": "0:08:15",
    "median_time_to_close": "0:58:37",
    "median_time_to_answer": "None",
    "median_time_in_draft": "0:04:50",
    "median_time_in_labels": {},
    "90_percentile_time_to_first_response": "6:46:59",
    "90_percentile_time_to_close": "1 day, 1:01:31",
    "90_percentile_time_to_answer": "None",
    "90_percentile_time_in_draft": "9:47:12",
    "90_percentile_time_in_labels": {},
    "num_items_opened": 0,
    "num_items_closed": 24,
    "num_mentor_count": 0,
    "total_item_count": 24,
    "issues": [
        {
            "title": "feat: add bypass to rate limiter",
            "html_url": "https://github.com/github/issue-metrics/pull/396",
            "author": "zkoppert",
            "time_to_first_response": "2 days, 5:21:02",
            "time_to_close": "2 days, 12:42:29",
            "time_to_answer": "None",
            "time_in_draft": "0:04:16",
            "label_metrics": {}
        },
        {
            "title": "chore: Remove unneeded pip install",
            "html_url": "https://github.com/github/issue-metrics/pull/393",
            "author": "zkoppert",
            "time_to_first_response": "0:00:35",
            "time_to_close": "0:02:24",
            "time_to_answer": "None",
            "time_in_draft": "None",
            "label_metrics": {}
        },
        {
            "title": "docs: Add OSSF Best Practices Badge",
            "html_url": "https://github.com/github/issue-metrics/pull/392",
            "author": "zkoppert",
            "time_to_first_response": "1:24:08",
            "time_to_close": "1:24:24",
            "time_to_answer": "None",
            "time_in_draft": "None",
            "label_metrics": {}
        },
        {
            "title": "chore: use setup python to improve OSSF scorecard",
            "html_url": "https://github.com/github/issue-metrics/pull/391",
            "author": "zkoppert",
            "time_to_first_response": "0:53:00",
            "time_to_close": "0:53:14",
            "time_to_answer": "None",
            "time_in_draft": "0:43:01",
            "label_metrics": {}
        },
        {
            "title": "Dont merge, testing",
            "html_url": "https://github.com/github/issue-metrics/pull/386",
            "author": "zkoppert",
            "time_to_first_response": "None",
            "time_to_close": "None",
            "time_to_answer": "None",
            "time_in_draft": "None",
            "label_metrics": {}
        },
        {
            "title": "fix: Remove more general part of duplicate actions permissions",
            "html_url": "https://github.com/github/issue-metrics/pull/382",
            "author": "zkoppert",
            "time_to_first_response": "0:01:08",
            "time_to_close": "0:58:37",
            "time_to_answer": "None",
            "time_in_draft": "0:00:29",
            "label_metrics": {}
        },
        {
            "title": "fix: Remove ignore_users authored items from markdown results",
            "html_url": "https://github.com/github/issue-metrics/pull/379",
            "author": "zkoppert",
            "time_to_first_response": "0:01:52",
            "time_to_close": "0:02:49",
            "time_to_answer": "None",
            "time_in_draft": "0:05:25",
            "label_metrics": {}
        },
        {
            "title": "fix: Catch review comments with no valid user",
            "html_url": "https://github.com/github/issue-metrics/pull/326",
            "author": "zkoppert",
            "time_to_first_response": "0:00:53",
            "time_to_close": "0:33:51",
            "time_to_answer": "None",
            "time_in_draft": "None",
            "label_metrics": {}
        },
        {
            "title": "fix: catch error that occurs when ghost usre creates an event.",
            "html_url": "https://github.com/github/issue-metrics/pull/325",
            "author": "zkoppert",
            "time_to_first_response": "0:01:35",
            "time_to_close": "7:03:38",
            "time_to_answer": "None",
            "time_in_draft": "None",
            "label_metrics": {}
        },
        {
            "title": "chore: pin shas in Dockerfile",
            "html_url": "https://github.com/github/issue-metrics/pull/315",
            "author": "zkoppert",
            "time_to_first_response": "0:08:15",
            "time_to_close": "0:14:39",
            "time_to_answer": "None",
            "time_in_draft": "None",
            "label_metrics": {}
        },
        {
            "title": "feat: Add option to hide Number of items closed metric",
            "html_url": "https://github.com/github/issue-metrics/pull/313",
            "author": "zkoppert",
            "time_to_first_response": "0:02:29",
            "time_to_close": "1 day, 0:48:49",
            "time_to_answer": "None",
            "time_in_draft": "0:01:31",
            "label_metrics": {}
        },
        {
            "title": "fix: issue counts incorrect when HIDE_TIME_TO_CLOSE is True",
            "html_url": "https://github.com/github/issue-metrics/pull/311",
            "author": "zkoppert",
            "time_to_first_response": "15:12:32",
            "time_to_close": "1 day, 19:34:15",
            "time_to_answer": "None",
            "time_in_draft": "None",
            "label_metrics": {}
        },
        {
            "title": "chore: add Jacob to pr reviews automatically",
            "html_url": "https://github.com/github/issue-metrics/pull/304",
            "author": "zkoppert",
            "time_to_first_response": "0:02:36",
            "time_to_close": "0:03:24",
            "time_to_answer": "None",
            "time_in_draft": "None",
            "label_metrics": {}
        },
        {
            "title": "ci: Add Jeff to review new data releases",
            "html_url": "https://github.com/github/issue-metrics/pull/298",
            "author": "zkoppert",
            "time_to_first_response": "0:02:17",
            "time_to_close": "0:09:52",
            "time_to_answer": "None",
            "time_in_draft": "None",
            "label_metrics": {}
        },
        {
            "title": "ci: release when a new feature hits main",
            "html_url": "https://github.com/github/issue-metrics/pull/296",
            "author": "zkoppert",
            "time_to_first_response": "0:02:03",
            "time_to_close": "0:05:46",
            "time_to_answer": "None",
            "time_in_draft": "None",
            "label_metrics": {}
        },
        {
            "title": "chore: Switch to weekly dep updates to reduce noise",
            "html_url": "https://github.com/github/issue-metrics/pull/278",
            "author": "zkoppert",
            "time_to_first_response": "1:35:16",
            "time_to_close": "1:40:57",
            "time_to_answer": "None",
            "time_in_draft": "None",
            "label_metrics": {}
        },
        {
            "title": "feat: Split markdown files when larger than max issue body size",
            "html_url": "https://github.com/github/issue-metrics/pull/265",
            "author": "zkoppert",
            "time_to_first_response": "0:34:16",
            "time_to_close": "1 day, 1:04:42",
            "time_to_answer": "None",
            "time_in_draft": "None",
            "label_metrics": {}
        },
        {
            "title": "fix: handle multiple repos in search query",
            "html_url": "https://github.com/github/issue-metrics/pull/261",
            "author": "zkoppert",
            "time_to_first_response": "4:40:36",
            "time_to_close": "17:13:18",
            "time_to_answer": "None",
            "time_in_draft": "None",
            "label_metrics": {}
        },
        {
            "title": "fix: Performance fix to only measure statistics which are not hidden",
            "html_url": "https://github.com/github/issue-metrics/pull/239",
            "author": "zkoppert",
            "time_to_first_response": "1:07:24",
            "time_to_close": "23:08:08",
            "time_to_answer": "None",
            "time_in_draft": "None",
            "label_metrics": {}
        },
        {
            "title": "switch to v3",
            "html_url": "https://github.com/github/issue-metrics/pull/223",
            "author": "zkoppert",
            "time_to_first_response": "0:44:33",
            "time_to_close": "4:08:46",
            "time_to_answer": "None",
            "time_in_draft": "18:51:23",
            "label_metrics": {}
        },
        {
            "title": "Update CODEOWNERS",
            "html_url": "https://github.com/github/issue-metrics/pull/220",
            "author": "zkoppert",
            "time_to_first_response": "None",
            "time_to_close": "0:06:37",
            "time_to_answer": "None",
            "time_in_draft": "None",
            "label_metrics": {}
        },
        {
            "title": "Use keep label to exempt issues from stale action",
            "html_url": "https://github.com/github/issue-metrics/pull/216",
            "author": "zkoppert",
            "time_to_first_response": "None",
            "time_to_close": "0:05:00",
            "time_to_answer": "None",
            "time_in_draft": "None",
            "label_metrics": {}
        },
        {
            "title": "Create stale.yaml",
            "html_url": "https://github.com/github/issue-metrics/pull/214",
            "author": "zkoppert",
            "time_to_first_response": "None",
            "time_to_close": "2:29:51",
            "time_to_answer": "None",
            "time_in_draft": "None",
            "label_metrics": {}
        },
        {
            "title": "Update issue creation action version",
            "html_url": "https://github.com/github/issue-metrics/pull/201",
            "author": "zkoppert",
            "time_to_first_response": "None",
            "time_to_close": "0:09:39",
            "time_to_answer": "None",
            "time_in_draft": "None",
            "label_metrics": {}
        }
    ],
    "search_query": "repo:github/issue-metrics is:pr author:zkoppert created:2024-01-01..2024-10-14"
}

@zkoppert zkoppert self-assigned this Oct 23, 2024
@zkoppert zkoppert marked this pull request as ready for review October 23, 2024 20:57
@zkoppert zkoppert mentioned this pull request Oct 23, 2024
Copy link
Member

@jmeridth jmeridth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. Love the explicit argument names clean up. Couple copy/paste changes 😉

time_in_draft.py Outdated Show resolved Hide resolved
time_in_draft.py Outdated Show resolved Hide resolved
time_in_draft.py Outdated Show resolved Hide resolved
zkoppert and others added 3 commits October 23, 2024 21:28
Co-authored-by: JM (Jason Meridth) <[email protected]>
Co-authored-by: JM (Jason Meridth) <[email protected]>
Co-authored-by: JM (Jason Meridth) <[email protected]>
@zkoppert zkoppert merged commit 4888b60 into main Oct 24, 2024
31 checks passed
@zkoppert zkoppert deleted the draft-tracking branch October 24, 2024 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support draft PRs
2 participants