Skip to content

Commit

Permalink
Merge pull request #103 from nextcloud/docs/link-to-workflow-template
Browse files Browse the repository at this point in the history
docs: Link to template repo for the CI workflow
  • Loading branch information
nickvergessen authored Mar 14, 2024
2 parents 09030f8 + 0fbc9b1 commit 055ea76
Showing 1 changed file with 2 additions and 40 deletions.
42 changes: 2 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,47 +18,9 @@ This tool should be added as a dev dependency to the `composer.json` of your app
}
```

## Create a CI workflow
## Create a CI workflow to check the specifications are up-to-date

Put the following at `.github/workflows/openapi.yml`:

```yaml
name: OpenAPI

on:
pull_request:
push:
branches:
- main

jobs:
openapi:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up php
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: xml
coverage: none
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Composer install
run: composer i

- name: OpenAPI checker
run: |
composer exec generate-spec
if [ -n "$(git status --porcelain openapi.json)" ]; then
git diff
exit 1
fi
```
The Workflow template repository has a template available: https://github.com/nextcloud/.github/blob/master/workflow-templates/openapi.yml

Afterward in your repository settings set the OpenAPI workflow to be required for merging pull requests.

Expand Down

0 comments on commit 055ea76

Please sign in to comment.