-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Animesh Pathak <[email protected]>
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Keep Alive Ping | ||
|
||
on: | ||
schedule: | ||
- cron: '*/10 * * * *' # Runs every 10 minutes | ||
workflow_dispatch: # Allows manual triggering | ||
|
||
jobs: | ||
ping: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Send HTTP GET request | ||
run: | | ||
response=$(curl -s -w "\n%{http_code}" https://gitstats-b6tv.onrender.com) | ||
status_code=$(echo "$response" | tail -n1) | ||
content=$(echo "$response" | sed '$d') | ||
echo "Status code: $status_code" | ||
echo "Response content: $content" | ||
if [ "$status_code" -ne 200 ]; then | ||
echo "Error: Received status code $status_code" | ||
exit 1 | ||
fi | ||
- name: Notify on failure | ||
if: failure() | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
github.rest.issues.create({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
title: 'Ping Service Failed', | ||
body: `Service ping failed at ${new Date().toISOString()}\nPlease check https://gitstats-b6tv.onrender.com` | ||
}) |