Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Gather metrics on issues/prs/discussions such as time to first response, count of issues opened, closed, etc.

License

NotificationsYou must be signed in to change notification settings

github/issue-metrics

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodeQLDocker Image CIPython packageOpenSSF ScorecardOpenSSF Best Practices

This is a GitHub Action that searches for issues/pull requests/discussions in a repository, measures several metrics, and generates a report in form of a GitHub issue.The issues/pull requests/discussions to search for can be filtered by using a search query.

This action, developed by GitHub OSPO for our internal use, is open-sourced for your potential benefit.Feel free to inquire about its usage by creating an issue in this repository.

Available Metrics

MetricDescription
Time to First ResponseThe duration from creation to the initial comment or review.*
Time to CloseThe period from creation to closure.*
Time to Answer (Discussions Only)The time from creation to an answer.
Time in LabelThe duration from label application to removal, requiresLABELS_TO_MEASURE env variable.
Time in Draft (PRs Only)The duration from creation to the PR being marked as ready for review.

*For pull requests, these metrics exclude the time the PR was in draft mode.

*For issues and pull requests, comments by issue/pull request author's and comments by bots are excluded.

To find syntax for search queries, check out the documentation onsearching issues and pull requestsorsearching discussions.

Sample Report

The output of this action is a report in form of a GitHub issue.Below you see a sample of such a GitHub issue.

Sample GitHub issue created by the issue/metrics GitHub Action

Getting Started

Create a workflow file (ie..github/workflows/issue-metrics.yml) in your repository with the following contents:

Note:repo:owner/repo is the repository you want to measure metrics on

name:Monthly issue metricson:workflow_dispatch:schedule:    -cron:"3 2 1 * *"permissions:contents:readjobs:build:name:issue metricsruns-on:ubuntu-latestpermissions:issues:writepull-requests:readsteps:      -name:Get dates for last monthshell:bashrun:|          # Calculate the first day of the previous month          first_day=$(date -d "last month" +%Y-%m-01)          # Calculate the last day of the previous month          last_day=$(date -d "$first_day +1 month -1 day" +%Y-%m-%d)          #Set an environment variable with the date range          echo "$first_day..$last_day"          echo "last_month=$first_day..$last_day" >> "$GITHUB_ENV"      -name:Run issue-metrics tooluses:github/issue-metrics@v3env:GH_TOKEN:${{ secrets.GITHUB_TOKEN }}SEARCH_QUERY:'repo:owner/repo is:issue created:${{ env.last_month }} -reason:"not planned"'      -name:Create issueuses:peter-evans/create-issue-from-file@v5with:title:Monthly issue metrics reporttoken:${{ secrets.GITHUB_TOKEN }}content-filepath:./issue_metrics.md

Example use cases

  • As a maintainer, I want to see metrics for issues and pull requests on the repository I maintain in order to ensure I am giving them the proper amount of attention.
  • As a first responder on a repository, I want to ensure that users are getting contact from me in a reasonable amount of time.
  • As an OSPO, I want to see how many open source repository requests are open/closed, and metrics for how long it takes to get through the open source process.
  • As a product development team, I want to see metrics around how long pull request reviews are taking, so that we can reflect on that data during retrospectives.

Support

If you need support using this project or have questions about it, pleaseopen up an issue in this repository. Requests made directly to GitHub staff or support team will be redirected here to open an issue. GitHub SLA's and support/services contracts do not apply to this repository.

OSPO GitHub Actions as a Whole

All feedback regarding our GitHub Actions, as a whole, should be communicated throughissues on our github-ospo repository.

Use as a GitHub Action

  1. Create a repository to host this GitHub Action or select an existing repository. This is easiest if it is the same repository as the one you want to measure metrics on.
  2. Select a best fit workflow file from theexamples directory for your use case.
  3. Copy that example into your repository (from step 1) and into the proper directory for GitHub Actions:.github/workflows/ directory with the file extension.yml (ie..github/workflows/issue-metrics.yml)
  4. Edit the values (SEARCH_QUERY,assignees) from the sample workflow with your information. See theSEARCH_QUERY section for more information on how to configure the search query.
  5. If you are running metrics on a repository other than the one where the workflow file is going to be, then update the value ofGH_TOKEN.
    • Do this by creating aGitHub API token with permissions to read the repository and write issues.
    • Then take the value of the API token you just created, andcreate a repository secret where the name of the secret isGH_TOKEN and the value of the secret the API token.
    • Then finally update the workflow file to use that repository secret by changingGH_TOKEN: ${{ secrets.GITHUB_TOKEN }} toGH_TOKEN: ${{ secrets.GH_TOKEN }}. The name of the secret can really be anything. It just needs to match between when you create the secret name and when you refer to it in the workflow file.
    • Help on verifying your token's access to your repositoryhere
  6. If you want the resulting issue with the metrics in it to appear in a different repository other than the one the workflow file runs in, update the linetoken: ${{ secrets.GITHUB_TOKEN }} with your own GitHub API token stored as a repository secret.
    • This process is the same as described in the step above. More info on creating secrets can be foundhere.
  7. Commit the workflow file to the default branch (oftenmaster ormain)
  8. Wait for the action to trigger based on theschedule entry or manually trigger the workflow as shown in thedocumentation.

Configuration

Below are the allowed configuration options:

Authentication

This action can be configured to authenticate with GitHub App Installation or Personal Access Token (PAT). If all configuration options are provided, the GitHub App Installation configuration has precedence. You can choose one of the following methods to authenticate:

GitHub App Installation
fieldrequireddefaultdescription
GH_APP_IDTrue""GitHub Application ID. Seedocumentation for more details.
GH_APP_INSTALLATION_IDTrue""GitHub Application Installation ID. Seedocumentation for more details.
GH_APP_PRIVATE_KEYTrue""GitHub Application Private Key. Seedocumentation for more details.
GITHUB_APP_ENTERPRISE_ONLYFalsefalseSet this input totrue if your app is created in GHE and communicates with GHE.
Personal Access Token (PAT)
fieldrequireddefaultdescription
GH_TOKENTrue""The GitHub Token used to scan the repository. Must have read access to all repository you are interested in scanning.

Other Configuration Options

fieldrequireddefaultdescription
GH_ENTERPRISE_URLFalse""URL of GitHub Enterprise instance to use for auth instead of github.com
RATE_LIMIT_BYPASSFalsefalseIf set totrue, the rate limit will be bypassed. This is useful if being run on an local GitHub server with rate limiting disabled.
HIDE_AUTHORFalseFalseIf set totrue, the author will not be displayed in the generated Markdown file.
HIDE_ITEMS_CLOSED_COUNTFalseFalseIf set totrue, the number of items closed metric will not be displayed in the generated Markdown file.
HIDE_LABEL_METRICSFalseFalseIf set totrue, the time in label metrics will not be displayed in the generated Markdown file.
HIDE_TIME_TO_ANSWERFalseFalseIf set totrue, the time to answer a discussion will not be displayed in the generated Markdown file.
HIDE_TIME_TO_CLOSEFalseFalseIf set totrue, the time to close will not be displayed in the generated Markdown file.
HIDE_TIME_TO_FIRST_RESPONSEFalseFalseIf set totrue, the time to first response will not be displayed in the generated Markdown file.
HIDE_CREATED_ATFalseTrueIf set totrue, the creation timestmap will not be displayed in the generated Markdown file.
DRAFT_PR_TRACKINGFalseFalseIf set totrue, draft PRs will be included in the metrics as a new column and in the summary stats.
IGNORE_USERSFalseFalseA comma separated list of users to ignore when calculating metrics. (ie.IGNORE_USERS: 'user1,user2'). To ignore bots, append[bot] to the user (ie.IGNORE_USERS: 'github-actions[bot]') Users in this list will also have their authored issues and pull requests removed from the Markdown table.
ENABLE_MENTOR_COUNTFalseFalseIf set to 'TRUE' count number of comments users left on discussions, issues and PRs and display number of active mentors
MIN_MENTOR_COMMENTSFalse10Minimum number of comments to count as a mentor
MAX_COMMENTS_EVALFalse20Maximum number of comments per thread to evaluate for mentor stats
HEAVILY_INVOLVED_CUTOFFFalse3Cutoff after which a mentor's comments in one issue are no longer counted against their total score
LABELS_TO_MEASUREFalse""A comma separated list of labels to measure how much time the label is applied. If not provided, no labels durations will be measured. Not compatible with discussions at this time.
NON_MENTIONING_LINKSFalseFalseIf set totrue, will use non-mentioning GitHub links to avoid linking to the generated issue from the source repository. Links of the formhttps://www.github.com will be used.
OUTPUT_FILEFalseissue_metrics.md orissue_metrics.jsonOutput filename.
REPORT_TITLEFalse"Issue Metrics"Title to have on the report issue.
SEARCH_QUERYTrue""The query by which you can filter issues/PRs which must contain arepo:,org:,owner:, or auser: entry. For discussions, includetype:discussions in the query.

Further Documentation

Contributions

We would ❤️ contributions to improve this action. Please seeCONTRIBUTING.md for how to get involved.

Development Setup

  • Ensure you have python3.10+ installed
  • Clone this repository and cd intoissue-metrics
  • Create python virtual envpython3 -m venv .venv
  • Activate virtual envsource .venv/bin/activate
  • Install dependenciespip install -r requirements.txt -r requirements-test.txt
  • Run testsmake test
  • Run lintermake lint

License

MIT

More OSPO Tools

Looking for more resources for your open source program office (OSPO)? Check out thegithub-ospo repository for a variety of tools designed to support your needs.


[8]ページ先頭

©2009-2025 Movatter.jp