Skip to content

Check links in your CI pipeline to see if you get back the expected status code

Notifications You must be signed in to change notification settings

cinch-labs/url-status-checker

Repository files navigation

URL status checker

Check your API links to see if they bring back the expected status code. You can use this to verify that you have locked your API down correctly.

This is a github action that works off a config file that you specify in your repository - it runs through each link and checks that they match what you expect. The path to the file is relative to the base of your repository if you use the action as specified below

Usage

...
links_check:
  runs_on: ubuntu-latest
  steps:
    - uses: cinch-labs/url-status-checker@v1.1
      with:
        file: ./links.yml

Where your links.yml looks something like this:

links:
  - url: https://example.com
    statusCode: 200
    method: GET

The following methods are supported:

  • GET
  • PUT
  • POST
  • PATCH
  • OPTIONS
  • HEAD

If you are using PUT, POST or PATCH you can specify a request body like this:

links:
  - url: https://example.com
    statusCode: 200
    method: POST
    body: '{"test": 123, "example": 234}'

Optionally, if you have a lot of links you can set a common base url, e.g:

baseUrl: https://example.com
links:
  - url: /
    statusCode: 200
    method: GET

All URL's must then be specified relatively to the baseUrl - don't worry about trailing or beginning slashes, they will be trimmed as needed

About

Check links in your CI pipeline to see if you get back the expected status code

Resources

Stars

Watchers

Forks

Packages

No packages published