-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (41 loc) · 1.4 KB
/
Copy pathdashboard_status.yml
File metadata and controls
45 lines (41 loc) · 1.4 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
name: Dashboard Status Check
on:
push:
branches: [dev]
schedule:
- cron: '0 2 * * *' #2 am daily
workflow_dispatch: # Manual trigger
jobs:
check-status:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check dashboard status
id: status
run: |
STATUS_CODE=$(curl -s -o /dev/null -w "%{http_code}" https://footai-j05t.onrender.com)
if [ $STATUS_CODE -eq 200 ]; then
echo "status=online" >> $GITHUB_OUTPUT
echo "color=brightgreen" >> $GITHUB_OUTPUT
else
echo "status=offline" >> $GITHUB_OUTPUT
echo "color=red" >> $GITHUB_OUTPUT
fi
- name: Create badge JSON
run: |
mkdir -p assets/badge
cat > assets/badge/dashboard_status.json << EOF
{
"schemaVersion": 1,
"label": "dashboard status",
"message": "${{ steps.status.outputs.status }}",
"color": "${{ steps.status.outputs.color }}"
}
EOF
- name: Commit badge data
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add assets/badge/dashboard_status.json
git diff --quiet && git diff --staged --quiet || git commit -m "Update dashboard status badge"
git push