From fa891cb4a93508d2dbc0c5b1823b24b2f70c9603 Mon Sep 17 00:00:00 2001 From: Yash Date: Thu, 25 Jan 2024 23:54:59 +0530 Subject: [PATCH] issue metrics action --- .github/workflows/issue-metrics.yml | 41 +++++++++++++++++++++++++++++ 1 file changed, 41 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 000000000..47f9c93ca --- /dev/null +++ b/.github/workflows/issue-metrics.yml @@ -0,0 +1,41 @@ +name: Weekly issue metrics +on: + workflow_dispatch: + schedule: + - cron: "0 0 * * 0" + +permissions: + issues: write + pull-requests: read + +jobs: + build: + name: issue metrics + runs-on: ubuntu-latest + steps: + - name: Get dates for last week + shell: bash + run: | + # Calculate the first day of the last week + first_day=$(date -d "last week" +%Y-%m-%d) + + # Calculate the last day of the last week + last_day=$(date -d "$first_day +6 days" +%Y-%m-%d) + + # Set an environment variable with the date range + echo "First day of last week: $first_day" + echo "Last day of last week: $last_day" + echo "last_week=$first_day..$last_day" >> "$GITHUB_ENV" + + - name: Run issue-metrics tool + uses: github/issue-metrics@v2 + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SEARCH_QUERY: 'repo:owner/repo is:issue created:${{ env.last_week }} -reason:"not planned"' + + - name: Create issue + uses: peter-evans/create-issue-from-file@v4 + with: + title: Weekly issue metrics report + token: ${{ secrets.GITHUB_TOKEN }} + content-filepath: ./issue_metrics.md