fix: correct markdown table parsing for metrics
- Use awk -F'|' to parse markdown table columns properly - Extract actual numbers instead of table headers - Should now show '7' instead of '| Total number of items created | 7 |'
This commit is contained in:
14
.github/workflows/weekly-metrics-discord.yml
vendored
14
.github/workflows/weekly-metrics-discord.yml
vendored
@@ -49,10 +49,10 @@ jobs:
|
||||
# Parse the metrics from the generated markdown files
|
||||
if [ -f "issue_metrics.md" ]; then
|
||||
# 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")
|
||||
AVG_TIME_TO_FIRST_RESPONSE=$(grep -A 1 "Average time to first response" issue_metrics.md | tail -1 | awk '{print $3}' || echo "N/A")
|
||||
AVG_TIME_TO_CLOSE=$(grep -A 1 "Average time to close" issue_metrics.md | tail -1 | awk '{print $3}' || echo "N/A")
|
||||
NUM_ISSUES_CREATED=$(grep "Total number of items created" issue_metrics.md | awk -F'|' '{print $3}' | xargs || echo "0")
|
||||
NUM_ISSUES_CLOSED=$(grep "Number of items closed" issue_metrics.md | awk -F'|' '{print $3}' | xargs || echo "0")
|
||||
else
|
||||
NUM_ISSUES_CREATED=0
|
||||
NUM_ISSUES_CLOSED=0
|
||||
@@ -61,9 +61,9 @@ jobs:
|
||||
fi
|
||||
|
||||
if [ -f "pr_metrics.md" ]; then
|
||||
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")
|
||||
PR_AVG_TIME_TO_MERGE=$(grep -A 1 "Average time to close" pr_metrics.md | tail -1 | awk '{print $3}' || echo "N/A")
|
||||
NUM_PRS_CREATED=$(grep "Total number of items created" pr_metrics.md | awk -F'|' '{print $3}' | xargs || echo "0")
|
||||
NUM_PRS_MERGED=$(grep "Number of items closed" pr_metrics.md | awk -F'|' '{print $3}' | xargs || echo "0")
|
||||
else
|
||||
NUM_PRS_CREATED=0
|
||||
NUM_PRS_MERGED=0
|
||||
|
||||
Reference in New Issue
Block a user