A tiny GitHub Action that requests a URL and fails the job if it doesn't return the status you expect. Handy right after a deploy to confirm your app actually came up.
No dependencies — just Node's built-in fetch. Nothing to install or bundle.
| Input | Required | Default | What it does |
|---|---|---|---|
url |
yes | https://example.com |
The URL to check. |
expected-status |
no | 200 |
The status code that means healthy. |
timeout-ms |
no | 5000 |
Give up after this many milliseconds. |
| Output | What it is |
|---|---|
status |
The HTTP status code that came back. |
duration-ms |
How long the request took, in ms. |
Check your own app after a deploy:
- name: Check the site is up
uses: knjoroge/js-action@v2
with:
url: 'https://your-app.com/health'
expected-status: '200'Read an output in a later step:
- name: Health check
id: health
uses: knjoroge/js-action@v2
with:
url: 'https://your-app.com/health'
- name: Show the result
run: echo "Got ${{ steps.health.outputs.status }} in ${{ steps.health.outputs.duration-ms }}ms"npm test # runs the tests (Node's built-in test runner, no installs)