Skip to content

[⏳ GitHub Action] Polls a specified HTTP(S) endpoint until it responds with the expected status code or the timeout is exceeded.

Notifications You must be signed in to change notification settings

HarryVasanth/wait-for-http-endpoint

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wait for HTTP(S) Endpoint Action

This is a simple GitHub action that polls a specified HTTP(S) endpoint until it responds with the expected status code or the timeout is exceeded.

Features

  • Configurable HTTP method, timeout, and polling interval
  • Support for multiple expected status codes
  • Detailed console output for debugging
  • Lightweight implementation using Bash and curl

Inputs

Input Description Required Default
url The URL to poll Yes N/A
method The HTTP method to use No GET
expected-status Expected HTTP status code(s) (comma-separated) No 200
timeout Maximum polling time in milliseconds No 60000
interval Polling interval in milliseconds No 1000

Usage

steps:
  - name: Wait for API to be ready
    uses: harryvasanth/wait-for-http-endpoint@v1
    with:
      url: http://api.example.com/health
      method: GET
      expected-status: 200,201
      timeout: 30000
      interval: 500

Example

Wait for a local development server to start:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Start server
        run: npm start &
      - name: Wait for server
        uses: harryvasanth/wait-for-http-endpoint@v1
        with:
          url: http://localhost:3000
          timeout: 60000
      - name: Run tests
        run: npm test

About

[⏳ GitHub Action] Polls a specified HTTP(S) endpoint until it responds with the expected status code or the timeout is exceeded.

Resources

Code of conduct

Security policy

Stars

Watchers

Forks