Skip to content

hey-api/upload-openapi-spec

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

Repository files navigation

Hey API logo

Upload OpenAPI Specification

🚀 A GitHub Action for uploading specifications to Hey API

Before using this GitHub Action, you must create a free account with Hey API and generate a project API key.

Usage

Create a new GitHub workflow or add an upload step to an existing workflow inside your API codebase.

name: Upload OpenAPI Specification

on:
  push:
    branches:
      - main
  pull_request:

jobs:
  upload-openapi-spec:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Upload OpenAPI spec
        uses: hey-api/[email protected]
        with:
          api-key: ${{ secrets.HEY_API_TOKEN }}
          path-to-file: path/to/openapi.json
          tags: optional,custom,tags

The example above will upload your OpenAPI specification to Hey API on every pull request and push to the main branch.

Inputs

To successfully upload an OpenAPI specification, you need to provide the following inputs (see with in the example above)

api-key

This is the project API key you obtained from Hey API.

Note: Personal API keys can't be used to upload specifications.

path-to-file

A relative path to your OpenAPI file within the repository. Note that you might need an additional step in your GitHub workflow to generate this file (see FastAPI example).

tags (optional)

A comma-separated string value representing any custom tags you wish to add to your OpenAPI specification.

Next Steps

Please follow the integrations guide on our website for the next steps.