From 34f7613d37a8cb1d5b4d1b4fb7b2cb5410853cdf Mon Sep 17 00:00:00 2001 From: Aditya Singh Date: Wed, 12 Nov 2025 21:46:23 +0530 Subject: [PATCH] Add health check workflow for application --- .github/workflows/health-check.yml | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/health-check.yml diff --git a/.github/workflows/health-check.yml b/.github/workflows/health-check.yml new file mode 100644 index 0000000..d615550 --- /dev/null +++ b/.github/workflows/health-check.yml @@ -0,0 +1,32 @@ +name: Health Check + +on: + schedule: + - cron: '0 */6 * * *' + workflow_dispatch: + +jobs: + health: + name: Check Application Health + runs-on: ubuntu-latest + + steps: + - name: Pull latest image + run: docker pull ${{ secrets.DOCKERHUB_USERNAME }}/quote-app:latest + + - name: Run container + run: | + docker run -d --name health-check -p 3000:3000 \ + ${{ secrets.DOCKERHUB_USERNAME }}/quote-app:latest + + - name: Wait for startup + run: sleep 10 + + - name: Health check + run: | + curl -f http://localhost:3000/health || exit 1 + curl -f http://localhost:3000/api/quotes/random || exit 1 + + - name: Cleanup + if: always() + run: docker rm -f health-check