From f1226dd1430538702059a8911f74f5d277cbafa8 Mon Sep 17 00:00:00 2001 From: Yeming Liu <11371776+isra-fel@users.noreply.github.com> Date: Wed, 1 Oct 2025 16:08:04 +1000 Subject: [PATCH 1/2] Add monthly issue metrics workflow This workflow calculates and reports monthly issue metrics for the repository. --- .github/workflows/issue-metrics.yml | 42 +++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/issue-metrics.yml diff --git a/.github/workflows/issue-metrics.yml b/.github/workflows/issue-metrics.yml new file mode 100644 index 000000000000..b30c3a1fc1b1 --- /dev/null +++ b/.github/workflows/issue-metrics.yml @@ -0,0 +1,42 @@ +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:Azure/azure-powershell is:pr created:${{ env.last_month }} draft:false' + + - 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 From 15faec3fdf3a9be51c6f92f58496c4d6e4792952 Mon Sep 17 00:00:00 2001 From: Yeming Liu <11371776+isra-fel@users.noreply.github.com> Date: Wed, 1 Oct 2025 16:14:58 +1000 Subject: [PATCH 2/2] Modify issue-metrics workflow to track draft PRs Updated the search query to exclude draft PRs and added draft PR tracking. --- .github/workflows/issue-metrics.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/issue-metrics.yml b/.github/workflows/issue-metrics.yml index b30c3a1fc1b1..a09613c68e55 100644 --- a/.github/workflows/issue-metrics.yml +++ b/.github/workflows/issue-metrics.yml @@ -32,7 +32,8 @@ jobs: uses: github/issue-metrics@v3 env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SEARCH_QUERY: 'repo:Azure/azure-powershell is:pr created:${{ env.last_month }} draft:false' + SEARCH_QUERY: 'repo:Azure/azure-powershell is:pr created:${{ env.last_month }}' + DRAFT_PR_TRACKING: 'True' - name: Create issue uses: peter-evans/create-issue-from-file@v5