-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate-report.sh
More file actions
executable file
·32 lines (26 loc) · 1008 Bytes
/
generate-report.sh
File metadata and controls
executable file
·32 lines (26 loc) · 1008 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash
set -euo pipefail
# Generate a summary report from the sync output.
# This script is called by the GitHub Actions workflow after sync completes.
# Usage: generate-report.sh <report-file>
REPORT_FILE="${1:-reports/sync-report.md}"
if [ ! -f "$REPORT_FILE" ]; then
echo "ERROR: Report file not found: $REPORT_FILE"
exit 1
fi
# Extract summary metrics for the workflow
total_repos=$(grep "Total repositories" "$REPORT_FILE" | grep -oE '[0-9]+' || echo "0")
compliant=$(grep "Compliant" "$REPORT_FILE" | grep -oE '[0-9]+' || echo "0")
drift=$(grep "Drift detected" "$REPORT_FILE" | grep -oE '[0-9]+' || echo "0")
echo "total_repos=$total_repos"
echo "compliant=$compliant"
echo "drift=$drift"
# Output for GitHub Actions
if [ "${GITHUB_OUTPUT:-}" != "" ]; then
{
echo "total_repos=$total_repos"
echo "compliant=$compliant"
echo "drift=$drift"
echo "has_drift=$([ "$drift" -gt 0 ] && echo "true" || echo "false")"
} >> "$GITHUB_OUTPUT"
fi