Skip to content

Commit 9942807

Browse files
zkoppertspier
andauthored
pattern-metrics: Merge to one report (#599)
* Merge the 2 pattern-metrics reports into a single report * Change title of created issue * Add 'community metrics' label to created issue --------- Co-authored-by: Sebastian Spier <[email protected]>
1 parent 6b5ba9d commit 9942807

File tree

1 file changed

+13
-51
lines changed

1 file changed

+13
-51
lines changed

.github/workflows/pattern-metrics.yaml

Lines changed: 13 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -60,69 +60,31 @@ jobs:
6060
HIDE_TIME_TO_ANSWER: "True"
6161
HIDE_LABEL_METRICS: "True"
6262

63-
- name: Create issue
64-
uses: peter-evans/create-issue-from-file@v4
65-
with:
66-
title: Monthly New Issues Data ${{ env.last_month }}
67-
token: ${{ secrets.GITHUB_TOKEN }}
68-
content-filepath: ./issue_metrics.md
69-
assignees: spier
70-
71-
pr-metrics:
72-
name: pull request metrics
73-
runs-on: ubuntu-latest
74-
75-
steps:
76-
77-
- name: Get dates for last month
63+
- name: Change markdown file name to prep for a merge
7864
shell: bash
7965
run: |
80-
# Calculate the first day of the previous month
81-
first_day=$(date -d "last month" +%Y-%m-01)
66+
mv ./issue_metrics.md ready_to_merge_issues_report.md
8267
83-
# Calculate the last day of the previous month
84-
last_day=$(date -d "$first_day +1 month -1 day" +%Y-%m-%d)
85-
86-
#Set an environment variable with the date range
87-
echo "$first_day..$last_day"
88-
echo "last_month=$first_day..$last_day" >> "$GITHUB_ENV"
89-
90-
- name: Check out the code so we can get the CODEOWNERS names
91-
uses: actions/checkout@v4
92-
with:
93-
sparse-checkout: |
94-
.github/CODEOWNERS
95-
sparse-checkout-cone-mode: false
96-
97-
- name: Get usernames from CODEOWNERS file
98-
shell: bash
99-
run: |
100-
# open a file called CODEOWNERS and load the content into a variable
101-
CODEOWNERS_FILE=$(cat .github/CODEOWNERS)
102-
103-
# Extract words from CODEOWNERS that start with @ and convert them into a comma-separated string
104-
# ie, "-author:spier -author:zkoppert"
105-
# This will be used to filter out these codeowners from certain stats in later steps
106-
CODEOWNERS_FILTER=$(echo $CODEOWNERS_FILE | grep -o "@[a-zA-Z0-9\-]*" | sed 's/@/-author:/g' | sort | uniq | tr '\n' ' ')
107-
108-
# Print usernames to terminal for easy debugging
109-
echo "CODEOWNERS_FILTER: $CODEOWNERS_FILTER"
110-
111-
# Store CODEOWNERS_FILTERto GitHub Action environment (not permanent)
112-
echo "CODEOWNERS_FILTER=$CODEOWNERS_FILTER" >> "$GITHUB_ENV"
113-
114-
- name: Run issue-metrics tool
68+
- name: Run issue-metrics tool for PRs
11569
uses: github/issue-metrics@v2
11670
env:
11771
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11872
SEARCH_QUERY: 'repo:InnerSourceCommons/InnerSourcePatterns is:pr created:${{ env.last_month }} -reason:"not planned" ${{ env.CODEOWNERS_FILTER }}'
11973
HIDE_TIME_TO_ANSWER: "True"
12074
HIDE_LABEL_METRICS: "True"
12175

76+
- name: Merge files for report
77+
shell: bash
78+
run: |
79+
echo $'\n\n---\n\n' > hr.md
80+
cat ready_to_merge_issues_report.md hr.md issue_metrics.md > all.md
81+
12282
- name: Create issue
12383
uses: peter-evans/create-issue-from-file@v4
12484
with:
125-
title: Monthly New Pull Request Data ${{ env.last_month }}
85+
title: Monthly Metrics: New Issues + New Pull Requests ${{ env.last_month }}
12686
token: ${{ secrets.GITHUB_TOKEN }}
127-
content-filepath: ./issue_metrics.md
87+
content-filepath: ./all.md
12888
assignees: spier
89+
labels: |
90+
community metrics

0 commit comments

Comments
 (0)