Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue metrics action #612

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/issue-metrics.yml
Original file line number Diff line number Diff line change
@@ -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
Loading