Skip to content

Commit

Permalink
Gathering pull requests metrics (#4766)
Browse files Browse the repository at this point in the history
* fix workflow dispatch trigger

* fix workflow dispatch trigger

* metrics for pr

* removed date from file name

* on push added

* wip

* date in issue name, workflow dispatch trigger

* Create long-keys-compare.md
  • Loading branch information
wojteknowacki authored Apr 2, 2024
1 parent 7d7fd4e commit ceada31
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .changeset/long-keys-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": minor
---

Changed trigger to workflow_dispatch and switched from issues to pr as a source of metrics
28 changes: 12 additions & 16 deletions .github/workflows/repo-metrics.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: Monthly issue metrics
on: repository_dispatch
name: Github metrics
on:
workflow_dispatch:

permissions:
contents: read

jobs:
build:
name: issue metrics
name: github metrics
runs-on: ubuntu-22.04
permissions:
issues: write
Expand All @@ -24,24 +26,18 @@ jobs:
echo "$first_day..$last_day"
echo "last_month=$first_day..$last_day" >> "$GITHUB_ENV"
- name: Run issue-metrics tool
#Set an environment variable containing month and year for issue name
echo "last_month_tag=$(date -d "last month" +%Y-%m)" >> "$GITHUB_ENV"
- name: Run metrics tool
uses: github/issue-metrics@v3
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SEARCH_QUERY: 'repo:saleor/saleor-dashboard is:issue created:${{ env.last_month }} -reason:"not planned"'

- name: Create issue metrics report
run: |
report_filename="issue_metrics_$(date +'%Y-%m').md"
echo "This is the monthly issue metrics report." > "$report_filename"
echo "Add your metrics data here." >> "$report_filename"
echo "report_filename=$report_filename" >> "$GITHUB_ENV"
# Set an environment variable with the tag which we append to the title of GH issue.
echo "last_month_tag=$(date -d "last month" +%Y-%m)" >> "$GITHUB_ENV"
SEARCH_QUERY: 'repo:saleor/saleor-dashboard is:pr created:${{ env.last_month }} -reason:"not planned"'

- name: Create issue
uses: peter-evans/create-issue-from-file@24452a72d85239eacf1468b0f1982a9f3fec4c94 # v5.0.0
with:
title: Monthly issue metrics report for ${{ env.last_month_tag }}
title: Monthly pr metrics report for ${{ env.last_month_tag }}
token: ${{ secrets.GITHUB_TOKEN }}
content-filepath: ${{ env.report_filename }}
content-filepath: ./issue_metrics.md

0 comments on commit ceada31

Please sign in to comment.