Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
docs: add GitHub Actions example
Browse files Browse the repository at this point in the history
  • Loading branch information
hanspagel committed Feb 8, 2024
1 parent f3dc9b8 commit ef88e71
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,41 @@ scalar share openapi.json

[Full documentation](https://github.com/scalar/cli/blob/main/packages/cli/README.md)

### GitHub Actions

To validate your OpenAPI file in GitHub Actions, add this workflow:

```yml
# .github/workflows/validate-openapi-file.yml
name: Validate OpenAPI File

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
validate:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Validate OpenAPI File
# Replace `./my-openapi-file.json` with the correct path and filename for your project.
# Or: run `npx @scalar/cli init` and add the config file to your repository.
run: npx @scalar/cli validate ./my-openapi-file.json
```
## Community
We are API nerds. You too? Let’s chat on Discord: <https://discord.gg/8HeZcRGPFS>
Expand Down

0 comments on commit ef88e71

Please sign in to comment.