Skip to content

Commit 544e4d1

Browse files
committed
fix: resolve shellcheck warnings in health-monitoring workflow
- Group echo commands to avoid SC2129 warnings about individual redirects - Use command grouping { cmd1; cmd2; } >> file pattern for better shell practices
1 parent 53272d0 commit 544e4d1

1 file changed

Lines changed: 29 additions & 21 deletions

File tree

.github/workflows/health-monitoring.yml

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ jobs:
3939

4040
- name: Generate health report
4141
run: |
42-
echo "# Weekly Workflow Health Report" > health-report.md
43-
echo "" >> health-report.md
44-
echo "**Period:** ${{ env.START_DATE }} to ${{ env.END_DATE }}" >> health-report.md
45-
echo "**Repository:** ${{ github.repository }}" >> health-report.md
46-
echo "" >> health-report.md
47-
48-
# Convert CSV to markdown table
49-
echo "## Workflow Statistics" >> health-report.md
50-
echo "" >> health-report.md
42+
{
43+
echo "# Weekly Workflow Health Report"
44+
echo ""
45+
echo "**Period:** ${{ env.START_DATE }} to ${{ env.END_DATE }}"
46+
echo "**Repository:** ${{ github.repository }}"
47+
echo ""
48+
echo "## Workflow Statistics"
49+
echo ""
50+
} > health-report.md
5151
if [ -f workflow-stats.csv ]; then
5252
header=$(head -n 1 workflow-stats.csv | sed 's/,/|/g' | sed 's/_/ /g')
5353
echo "|${header}|" >> health-report.md
@@ -58,9 +58,11 @@ jobs:
5858
echo "No workflow data available for this period." >> health-report.md
5959
fi
6060
61-
echo "" >> health-report.md
62-
echo "## Health Alerts" >> health-report.md
63-
echo "" >> health-report.md
61+
{
62+
echo ""
63+
echo "## Health Alerts"
64+
echo ""
65+
} >> health-report.md
6466
6567
# Check for workflows with low success rates
6668
if [ -f workflow-stats.csv ]; then
@@ -72,9 +74,11 @@ jobs:
7274
fi
7375
fi
7476
75-
echo "" >> health-report.md
76-
echo "---" >> health-report.md
77-
echo "*Generated automatically by [Workflow Health Monitoring](.github/workflows/health-monitoring.yml)*" >> health-report.md
77+
{
78+
echo ""
79+
echo "---"
80+
echo "*Generated automatically by [Workflow Health Monitoring](.github/workflows/health-monitoring.yml)*"
81+
} >> health-report.md
7882
7983
- name: Calculate badge metrics
8084
run: |
@@ -102,13 +106,17 @@ jobs:
102106
success_color="red"
103107
fi
104108
105-
echo "SUCCESS_RATE=$overall_success" >> "$GITHUB_ENV"
106-
echo "AVG_DURATION=${avg_duration}min" >> "$GITHUB_ENV"
107-
echo "SUCCESS_COLOR=$success_color" >> "$GITHUB_ENV"
109+
{
110+
echo "SUCCESS_RATE=$overall_success"
111+
echo "AVG_DURATION=${avg_duration}min"
112+
echo "SUCCESS_COLOR=$success_color"
113+
} >> "$GITHUB_ENV"
108114
else
109-
echo "SUCCESS_RATE=0" >> "$GITHUB_ENV"
110-
echo "AVG_DURATION=0min" >> "$GITHUB_ENV"
111-
echo "SUCCESS_COLOR=lightgrey" >> "$GITHUB_ENV"
115+
{
116+
echo "SUCCESS_RATE=0"
117+
echo "AVG_DURATION=0min"
118+
echo "SUCCESS_COLOR=lightgrey"
119+
} >> "$GITHUB_ENV"
112120
fi
113121
114122
- name: Create success rate badge

0 commit comments

Comments
 (0)