Skip to content

Commit 4b28e88

Browse files
authored
Add monthly issue metrics workflow (#28629)
1 parent 1b48e22 commit 4b28e88

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Monthly issue metrics
2+
on:
3+
workflow_dispatch:
4+
# schedule:
5+
# - cron: "3 2 1 * *"
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
build:
12+
name: issue metrics
13+
runs-on: ubuntu-latest
14+
permissions:
15+
issues: write
16+
pull-requests: read
17+
steps:
18+
- name: Get dates for last month
19+
shell: bash
20+
run: |
21+
# Calculate the first day of the previous month
22+
first_day=$(date -d "last month" +%Y-%m-01)
23+
24+
# Calculate the last day of the previous month
25+
last_day=$(date -d "$first_day +1 month -1 day" +%Y-%m-%d)
26+
27+
#Set an environment variable with the date range
28+
echo "$first_day..$last_day"
29+
echo "last_month=$first_day..$last_day" >> "$GITHUB_ENV"
30+
31+
- name: Run issue-metrics tool
32+
uses: github/issue-metrics@v3
33+
env:
34+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
SEARCH_QUERY: 'repo:Azure/azure-powershell is:pr created:${{ env.last_month }}'
36+
DRAFT_PR_TRACKING: 'True'
37+
38+
- name: Create issue
39+
uses: peter-evans/create-issue-from-file@v5
40+
with:
41+
title: Monthly issue metrics report
42+
token: ${{ secrets.GITHUB_TOKEN }}
43+
content-filepath: ./issue_metrics.md

0 commit comments

Comments
 (0)