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.
Metric Description Time to First Response The duration from creation to the initial comment or review.* Time to Close The period from creation to closure.* Time to Answer (Discussions Only) The time from creation to an answer. Time in Label The 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 on searching issues and pull requests or searching discussions.
The output of this action is a report in form of a GitHub issue. Below you see a sample of such a GitHub issue.
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 metrics on: workflow_dispatch: schedule: - cron: "3 2 1 * *" permissions: contents: read jobs: build: name: issue metrics runs-on: ubuntu-latest permissions: issues: write pull-requests: read steps: - name: Get dates for last month shell: bash run: | # 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 tool uses: github/issue-metrics@v3 env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} SEARCH_QUERY: 'repo:owner/repo is:issue created:${{ env.last_month }} -reason:"not planned"' - name: Create issue uses: peter-evans/create-issue-from-file@v5 with: title: Monthly issue metrics report token: ${{ secrets.GITHUB_TOKEN }} content-filepath: ./issue_metrics.md
If you need support using this project or have questions about it, please open 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 WholeAll feedback regarding our GitHub Actions, as a whole, should be communicated through issues on our github-ospo repository.
.github/workflows/
directory with the file extension .yml
(ie. .github/workflows/issue-metrics.yml
)SEARCH_QUERY
, assignees
) from the sample workflow with your information. See the SEARCH_QUERY section for more information on how to configure the search query.GH_TOKEN
.
GH_TOKEN
and the value of the secret the API token.GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
to GH_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.token: ${{ secrets.GITHUB_TOKEN }}
with your own GitHub API token stored as a repository secret.
master
or main
)schedule
entry or manually trigger the workflow as shown in the documentation.Below are the allowed configuration options:
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:
field required default descriptionGH_APP_ID
True ""
GitHub Application ID. See documentation for more details. GH_APP_INSTALLATION_ID
True ""
GitHub Application Installation ID. See documentation for more details. GH_APP_PRIVATE_KEY
True ""
GitHub Application Private Key. See documentation for more details. GITHUB_APP_ENTERPRISE_ONLY
False false Set this input to true
if your app is created in GHE and communicates with GHE. Personal Access Token (PAT) field required default description GH_TOKEN
True ""
The GitHub Token used to scan the repository. Must have read access to all repository you are interested in scanning. Other Configuration Options field required default description GH_ENTERPRISE_URL
False ""
URL of GitHub Enterprise instance to use for auth instead of github.com RATE_LIMIT_BYPASS
False false
If set to true
, the rate limit will be bypassed. This is useful if being run on an local GitHub server with rate limiting disabled. HIDE_ASSIGNEE
False False If set to true
, the assignee will not be displayed in the generated Markdown file. HIDE_AUTHOR
False False If set to true
, the author will not be displayed in the generated Markdown file. HIDE_ITEMS_CLOSED_COUNT
False False If set to true
, the number of items closed metric will not be displayed in the generated Markdown file. HIDE_LABEL_METRICS
False False If set to true
, the time in label metrics will not be displayed in the generated Markdown file. HIDE_TIME_TO_ANSWER
False False If set to true
, the time to answer a discussion will not be displayed in the generated Markdown file. HIDE_TIME_TO_CLOSE
False False If set to true
, the time to close will not be displayed in the generated Markdown file. HIDE_TIME_TO_FIRST_RESPONSE
False False If set to true
, the time to first response will not be displayed in the generated Markdown file. HIDE_CREATED_AT
False True If set to true
, the creation timestmap will not be displayed in the generated Markdown file. DRAFT_PR_TRACKING
False False If set to true
, draft PRs will be included in the metrics as a new column and in the summary stats. IGNORE_USERS
False False A 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_COUNT
False False If set to 'TRUE' count number of comments users left on discussions, issues and PRs and display number of active mentors MIN_MENTOR_COMMENTS
False 10 Minimum number of comments to count as a mentor MAX_COMMENTS_EVAL
False 20 Maximum number of comments per thread to evaluate for mentor stats HEAVILY_INVOLVED_CUTOFF
False 3 Cutoff after which a mentor's comments in one issue are no longer counted against their total score LABELS_TO_MEASURE
False ""
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_LINKS
False False If set to true
, will use non-mentioning GitHub links to avoid linking to the generated issue from the source repository. Links of the form https://www.github.com
will be used. OUTPUT_FILE
False issue_metrics.md
or issue_metrics.json
Output filename. REPORT_TITLE
False "Issue Metrics"
Title to have on the report issue. SEARCH_QUERY
True ""
The query by which you can filter issues/PRs which must contain a repo:
, org:
, owner:
, or a user:
entry. For discussions, include type:discussions
in the query.
SEARCH_QUERY
We would ❤️ contributions to improve this action. Please see CONTRIBUTING.md for how to get involved.
3.10+
installedissue-metrics
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt -r requirements-test.txt
make test
make lint
Looking for more resources for your open source program office (OSPO)? Check out the github-ospo
repository for a variety of tools designed to support your needs.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4