cleanup: revert to 7-day window and remove debug output

- Back to 7-day window now that parsing is fixed
- Remove debug output for cleaner workflow logs
- Workflow should now show real metrics reliably
This commit is contained in:
Ralph Khreish
2025-09-22 14:34:29 +02:00
parent 34b76ab2fa
commit e3d2ac5a7c

View File

@@ -19,14 +19,14 @@ jobs:
steps:
- name: Get dates for last week
run: |
# Last 14 days for more reliable metrics
first_day=$(date -d "14 days ago" +%Y-%m-%d)
# Last 7 days
first_day=$(date -d "7 days ago" +%Y-%m-%d)
last_day=$(date +%Y-%m-%d)
echo "first_day=$first_day" >> $GITHUB_ENV
echo "last_day=$last_day" >> $GITHUB_ENV
echo "week_of=$(date -d '7 days ago' +'Week of %B %d, %Y')" >> $GITHUB_ENV
echo "date_range=Past 14 days ($first_day to $last_day)" >> $GITHUB_ENV
echo "date_range=Past 7 days ($first_day to $last_day)" >> $GITHUB_ENV
- name: Generate issue metrics
uses: github/issue-metrics@v3
@@ -46,20 +46,14 @@ jobs:
- name: Parse metrics
id: metrics
run: |
echo "Debug: Checking for generated files..."
ls -la *.md || echo "No markdown files found"
# Parse the metrics from the generated markdown files
if [ -f "issue_metrics.md" ]; then
echo "Debug: Found issue_metrics.md, contents:"
cat issue_metrics.md
# Extract key metrics using grep/awk
AVG_TIME_TO_FIRST_RESPONSE=$(grep -A 1 "Average time to first response" issue_metrics.md | tail -1 | xargs || echo "N/A")
AVG_TIME_TO_CLOSE=$(grep -A 1 "Average time to close" issue_metrics.md | tail -1 | xargs || echo "N/A")
NUM_ISSUES_CREATED=$(grep -A 1 "Total number of items created" issue_metrics.md | tail -1 | xargs || echo "0")
NUM_ISSUES_CLOSED=$(grep -A 1 "Number of items closed" issue_metrics.md | tail -1 | xargs || echo "0")
else
echo "Debug: No issue_metrics.md file found"
NUM_ISSUES_CREATED=0
NUM_ISSUES_CLOSED=0
AVG_TIME_TO_FIRST_RESPONSE="N/A"
@@ -67,13 +61,10 @@ jobs:
fi
if [ -f "pr_metrics.md" ]; then
echo "Debug: Found pr_metrics.md, contents:"
cat pr_metrics.md
PR_AVG_TIME_TO_MERGE=$(grep -A 1 "Average time to close" pr_metrics.md | tail -1 | xargs || echo "N/A")
NUM_PRS_CREATED=$(grep -A 1 "Total number of items created" pr_metrics.md | tail -1 | xargs || echo "0")
NUM_PRS_MERGED=$(grep -A 1 "Number of items closed" pr_metrics.md | tail -1 | xargs || echo "0")
else
echo "Debug: No pr_metrics.md file found"
NUM_PRS_CREATED=0
NUM_PRS_MERGED=0
PR_AVG_TIME_TO_MERGE="N/A"
@@ -88,12 +79,6 @@ jobs:
echo "avg_time_to_close=${AVG_TIME_TO_CLOSE:-N/A}" >> $GITHUB_OUTPUT
echo "pr_avg_merge_time=${PR_AVG_TIME_TO_MERGE:-N/A}" >> $GITHUB_OUTPUT
echo "Debug: Final outputs:"
echo "Issues created: ${NUM_ISSUES_CREATED:-0}"
echo "Issues closed: ${NUM_ISSUES_CLOSED:-0}"
echo "PRs created: ${NUM_PRS_CREATED:-0}"
echo "PRs merged: ${NUM_PRS_MERGED:-0}"
- name: Send to Discord
uses: sarisia/actions-status-discord@v1
if: env.DISCORD_WEBHOOK != ''