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

Adding the Issue Metrics Action to generate metrics on how we manage issues (Lombiq Technologies: OCORE-139) #15041

Merged
merged 26 commits into from
Jan 30, 2024
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8de2c4f
Adding issue metrics-generating workflow
Piedone Jan 10, 2024
5bbc563
Adding PR metrics too
Piedone Jan 10, 2024
191e353
Fixing YML syntax
Piedone Jan 10, 2024
e4e78d4
Labeling auto-created issues
Piedone Jan 10, 2024
28d3de6
Excluding community metrics issues from the metrics
Piedone Jan 10, 2024
f2154ce
Adding the time frame to the issue titles too
Piedone Jan 10, 2024
46aea46
Adding missing label
Piedone Jan 10, 2024
dfd725a
Typo
Piedone Jan 10, 2024
15a71f5
Run at a more random time, not to do the same as others who used the …
Piedone Jan 10, 2024
1128b03
Hide time to answer
Piedone Jan 10, 2024
50e66e9
Fixing YML
Piedone Jan 10, 2024
017e6e4
Turning bash into PS
Piedone Jan 11, 2024
c650d63
Code styling
Piedone Jan 11, 2024
f098eb2
Concatenate issue metrics into a single piece and display them in the…
Piedone Jan 11, 2024
d282c46
Debug code
Piedone Jan 11, 2024
8cfdd07
Fixing access denied
Piedone Jan 11, 2024
11d0ace
New step summary
Piedone Jan 11, 2024
656c4d3
Fixing file name
Piedone Jan 11, 2024
d8a19f4
Better titles
Piedone Jan 11, 2024
d781c15
Merge remote-tracking branch 'origin/main' into zl/issue-metrics
Piedone Jan 11, 2024
b34d252
Reactivating issue creation
Piedone Jan 11, 2024
33cfe74
No need for the time to close column for discussion metrics, actually
Piedone Jan 11, 2024
b794f52
Merge branch 'main' into zl/issue-metrics
Piedone Jan 11, 2024
48f1b64
Removing temporary test code
Piedone Jan 17, 2024
59dd04e
Typos
Piedone Jan 26, 2024
bcf8fe8
Merge branch 'main' into zl/issue-metrics
Piedone Jan 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/issue-metrics.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Monthly Issue and Pull Request Metrics
on:
workflow_dispatch:
schedule:
# Run on the first day of every month at 2:19 AM UTC.
- cron: '19 2 1 * *'

permissions:
issues: write
pull-requests: read

jobs:
build:
name: Generate Issue and Pull Request Metrics
runs-on: ubuntu-latest
steps:
- name: Get Dates For Last Month
shell: pwsh
run: |
# Calculate the first day of the previous month.
$firstDay = (Get-Date).AddMonths(-1).ToString("yyyy-MM-01")

# Calculate the last day of the previous month.
$lastDay = (Get-Date $firstDay).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd")

# Set an environment variable with the date range.
Write-Output "$firstDay..$lastDay"
Write-Output "LAST_MONTH=$firstDay..$lastDay" >> $env:GITHUB_ENV

- name: Compute Issue Metrics
uses: github/issue-metrics@v2
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SEARCH_QUERY: 'repo:OrchardCMS/OrchardCore is:issue created:${{ env.LAST_MONTH }} -reason:"not planned" -label:"community metrics"'
HIDE_TIME_TO_ANSWER: true

- name: Rename Issue Metrics File
shell: pwsh
run: |
# Renaming the file wouldn't work since other scripts will be denied access to it for some reason.
Add-Content -Path ./community_metrics.md -Value (Get-Content -Path ./issue_metrics.md -Raw)

- name: Compute Pull Request Metrics
uses: github/issue-metrics@v2
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SEARCH_QUERY: 'repo:OrchardCMS/OrchardCore is:pr created:${{ env.LAST_MONTH }} -label:dontmerge -label:notready -is:draft'
HIDE_TIME_TO_ANSWER: true

- name: Concatenate Issue and Pull Request Metrics
shell: pwsh
run: |
$content = (Get-Content -Path ./issue_metrics.md -Raw) -replace '# Issue Metrics', '# Pull Request Metrics'
Add-Content -Path ./community_metrics.md -Value ([Environment]::NewLine + $content)

- name: Compute Q&A Discussion Request Metrics
uses: github/issue-metrics@v2
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SEARCH_QUERY: 'repo:OrchardCMS/OrchardCore type:discussions created:${{ env.LAST_MONTH }} category:Q&A'
HIDE_TIME_TO_CLOSE: true

- name: Concatenate Issue/PR and Discussion Metrics
shell: pwsh
run: |
$content = (Get-Content -Path ./issue_metrics.md -Raw) -replace '# Issue Metrics', '# Discussion Metrics'
Add-Content -Path ./community_metrics.md -Value ([Environment]::NewLine + $content)

- name: Display Issue Metrics in Summary
shell: pwsh
run: |
Get-Content ./community_metrics.md >> $env:GITHUB_STEP_SUMMARY

- name: Create Issue
# v4.0.1
uses: peter-evans/create-issue-from-file@433e51abf769039ee20ba1293a088ca19d573b7f
with:
title: Monthly community metrics report for ${{ env.LAST_MONTH }}
token: ${{ secrets.GITHUB_TOKEN }}
content-filepath: ./community_metrics.md
labels: community metrics
Loading