Skip to content

Commit be9bfd2

Browse files
feat(action): install OpenAPI Generator CLI
1 parent 7340a2e commit be9bfd2

3 files changed

Lines changed: 35 additions & 6 deletions

File tree

.github/workflows/test.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,29 @@ jobs:
1515
- name: Checkout repository
1616
uses: actions/checkout@v4
1717

18+
- name: Setup Java
19+
if: matrix.os == 'windows-latest'
20+
uses: actions/setup-java@v4
21+
with:
22+
distribution: temurin
23+
java-version: 21
24+
1825
- name: Run action
1926
uses: ./
2027

28+
- name: Get version
29+
run: openapi-generator-cli version
30+
2131
- name: Run action with version
2232
uses: ./
2333
with:
24-
version: 2.3.4
34+
version: 7.9.0
35+
36+
- name: Check version
37+
shell: bash
38+
run: |
39+
if [[ $(openapi-generator-cli version) != '7.9.0' ]]; then
40+
echo 'Version does not match. See version below:'
41+
openapi-generator-cli --version
42+
exit 1
43+
fi

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Setup OpenAPI
1919
uses: remarkablemark/setup-openapi@v1
2020

21-
- name: Generate Ruby client from spec
21+
- name: Generate Ruby Client
2222
run: openapi-generator-cli generate -i petstore.yaml -g ruby -o /tmp/test/
2323
```
2424
@@ -30,6 +30,12 @@ Install OpenAPI Generator CLI tool:
3030
- uses: remarkablemark/setup-openapi@v1
3131
```
3232
33+
Generate a Ruby client from a valid [petstore.yaml](https://petstore3.swagger.io/) doc:
34+
35+
```yaml
36+
- run: openapi-generator-cli generate -i petstore.yaml -g ruby -o /tmp/test/
37+
```
38+
3339
See [action.yml](action.yml)
3440
3541
## Inputs

action.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ inputs:
1010
runs:
1111
using: composite
1212
steps:
13-
- name: Print version
14-
shell: bash
15-
run: |
16-
echo "version: $VERSION"
13+
- name: Install OpenAPI Generator CLI
14+
shell: sh
15+
run: npm install --global @openapitools/openapi-generator-cli
16+
17+
- name: Set OpenAPI Generator Version
18+
if: inputs.version
19+
shell: sh
20+
run: openapi-generator-cli version-manager set $VERSION
1721
env:
1822
VERSION: ${{ inputs.version }}
1923

0 commit comments

Comments
 (0)