-
Notifications
You must be signed in to change notification settings - Fork 2
48 lines (37 loc) Β· 1.3 KB
/
uptime-active-check.yml
File metadata and controls
48 lines (37 loc) Β· 1.3 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Ensure Uptime Line Uncommented
on:
pull_request:
branches:
- main
jobs:
check-line:
runs-on: [self-hosted, homelab]
steps:
- uses: actions/checkout@v3
- name: Ensure main.cs exists
run: |
if [ ! -f "main.cs" ]; then
echo "β main.cs not found!"
exit 1
fi
- name: Check main.cs for uncommented line
env:
REQUIRED_LINE: "Uptime.StartHttpListener();"
run: |
FILE="main.cs"
echo "Searching for '${REQUIRED_LINE}' in $FILE"
# Find all lines containing the required string (with line numbers)
matches=$(grep -n -F "${REQUIRED_LINE}" "$FILE" || true)
if [ -z "$matches" ]; then
echo "β Required line '${REQUIRED_LINE}' is missing entirely"
exit 1
fi
echo "Found these lines containing '${REQUIRED_LINE}':"
echo "$matches"
# Strip line numbers before checking for comments
uncommented=$(echo "$matches" | cut -d: -f2- | grep -v '^[[:space:]]*//')
if [ -z "$uncommented" ]; then
echo "β All instances of '${REQUIRED_LINE}' are commented out"
exit 1
fi
echo "β
Found at least one uncommented instance of '${REQUIRED_LINE}'"