GitHub Action

Our GitHub action seamlessly integrates with your repository to ensure your APIs are consistently of high quality. It enables you to to help you to establish best practices & continuous quality monitoring for your OpenAPI's definitions by seamlessly integrating it to your repository & development workflow.

Usage

To get started add our GitHub action to your repository & configure it to run on Pull Requests and Pushes to ensure continuous quality monitoring.

Getting an API Key

You will need an API key as the GitHub Action uses the Rate My OpenAPI APIs which require the use of an API Key. You can sign up for free at https://api.ratemyopenapi.com/docs to get your API Key.

CAUTION: All reports generated by Rate My OpenAPI are public (with an unguessable UUID URL), even if uploaded with an API Key. Anyone with the URL to your report will be able to access the report.

Basic Setup

Lint an OpenAPI definition file using the default configuration

steps:
  - uses: actions/checkout@v4
  - uses: zuplo/rmoa-action@v1
    with:
      filepath: './my-api.json'
      apikey: ${{ secrets.RMOA_API_KEY }}

Advanced Setup

Lint an OpenAPI definition and override the minimum passing score (default is 80 out of 100) and set the maximum number of allowed warnings & errors.

steps:
  - uses: actions/checkout@v4
  - uses: zuplo/rmoa-action@v1
    with:
      filepath: './my-api.json'
      apikey: ${{ secrets.RMOA_API_KEY }}
      max-errors: 0
      max-warnings: 5
      minimum-score: 70

Configuration Options

- uses: zuplo/rmoa-action@v1
  with:
    # File containing the OpenAPI Spec to be linted.  Examples: my-api.oas.json, api-spec.yaml
    filepath: ''

    # The RMOA API Key issued when creating a user on https://api.ratemyopenapi.com/docs
    apikey: ''

    # The maximum number of warnings allowed before labeling the run as failed.
    max-warnings: ''

    # The maximum number of errors allowed before labeling the run as failed.
    max-errors: ''

    # The minimum score (0 - 100) to label a lint run as successful/passing. Default is 80.
    minimum-score: ''

Example

This example sets rmoa-action up in a workflow that will run on every pull request created on the repository. The pull request cannot be merged until the Open API specificaion in the my-api.json file reaches a minimum score of 80.

on:
  pull_request:
    branches: [$default-branch]

jobs:
  rate-my-open-api:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: zuplo/rmoa-action@v1
        with:
          filepath: './my-api.json'
          apikey: ${{ secrets.RMOA_API_KEY }}
      - name: Rate My Open API
        run: rmoa lint

Source code & documentation at zuplo/rmoa-action