-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* SWI-6181 Update Action * add additional-properties input * update readme
- Loading branch information
Showing
3 changed files
with
18 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,43 +5,27 @@ This action utilizes the [openapi-generator-cli](https://github.com/OpenAPITools | |
## Inputs | ||
|
||
```yml | ||
branch-name: | ||
description: Branch name | ||
required: true | ||
token: | ||
description: Github auth token | ||
required: true | ||
language: | ||
description: The generator name (language) (`-g`) argument for the openapi-generator-cli | ||
required: true | ||
config: | ||
description: The configuration (`-c`) argument for the openapi-generator-cli | ||
required: true | ||
user-email: | ||
description: Git user email | ||
default: [email protected] | ||
required: false | ||
username: | ||
description: Github username | ||
default: DX-Bandwidth | ||
default: ./openapi-config.yml | ||
api-spec-path: | ||
description: The destination of the API Specification to generate a client from | ||
required: false | ||
default: ./bandwidth.yml | ||
openapi-generator-version: | ||
description: The OpenAPI Generator project version, in `x.x.x` format | ||
required: false | ||
default: '6.5.0' | ||
api-spec-path: | ||
description: The destination of the API Specification to generate a client from | ||
default: '7.6.0' | ||
additional-properties: | ||
description: Additional properties to pass to the generator | ||
required: false | ||
default: ./bandwidth.yml | ||
working-directory: | ||
default: '' | ||
working-directory: | ||
description: The working directory to run the action in | ||
required: false | ||
default: ./ | ||
``` | ||
## Outputs | ||
```yml | ||
changes: | ||
description: Boolean representing if files in the SDK were changed or not. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,30 @@ | ||
name: Generate SDK Action | ||
description: Generate an SDK using the OpenAPI Generator Project | ||
inputs: | ||
branch-name: | ||
description: Branch name | ||
required: true | ||
token: | ||
description: Github auth token | ||
required: true | ||
language: | ||
description: The generator name (language) (`-g`) argument for the openapi-generator-cli | ||
required: true | ||
config: | ||
description: The configuration (`-c`) argument for the openapi-generator-cli | ||
required: true | ||
user-email: | ||
description: Git user email | ||
default: [email protected] | ||
required: false | ||
username: | ||
description: Github username | ||
default: DX-Bandwidth | ||
default: ./openapi-config.yml | ||
api-spec-path: | ||
description: The destination of the API Specification to generate a client from | ||
required: false | ||
default: ./bandwidth.yml | ||
openapi-generator-version: | ||
description: The OpenAPI Generator project version, in `x.x.x` format | ||
required: false | ||
default: '6.5.0' | ||
api-spec-path: | ||
description: The destination of the API Specification to generate a client from | ||
default: '7.6.0' | ||
additional-properties: | ||
description: Additional properties to pass to the generator | ||
required: false | ||
default: ./bandwidth.yml | ||
default: '' | ||
working-directory: | ||
description: The working directory to run the action in | ||
required: false | ||
default: ./ | ||
|
||
outputs: | ||
changes: | ||
description: Boolean representing if files in the SDK were changed or not. | ||
value: ${{ steps.commit.outputs.changes }} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
|
@@ -47,14 +33,6 @@ runs: | |
with: | ||
node-version: 20 | ||
|
||
- name: Configure Git and Create Branch | ||
run: | | ||
git config user.email ${{ inputs.user-email }} | ||
git config user.name ${{ inputs.username }} | ||
git checkout -b ${{ inputs.branch-name }} | ||
shell: bash | ||
working-directory: ${{ inputs.working-directory }} | ||
|
||
- name: Setup OpenAPI Generator CLI | ||
run: | | ||
npm install @openapitools/openapi-generator-cli -g | ||
|
@@ -68,22 +46,7 @@ runs: | |
-g ${{ inputs.language }} \ | ||
-i ${{ inputs.api-spec-path }} \ | ||
-c ${{ inputs.config }} \ | ||
${{ inputs.additional-properties }} \ | ||
-o ./ | ||
shell: bash | ||
working-directory: ${{ inputs.working-directory }} | ||
|
||
- name: Commit if Necessary | ||
id: commit | ||
run: | | ||
if git diff --quiet; then | ||
echo "No Changes" | ||
else | ||
git add . | ||
git commit -m "Generate SDK with OpenAPI Generator Version ${{ inputs.openapi-generator-version }}" | ||
git push origin ${{ inputs.branch-name }} | ||
echo "changes=true" >> $GITHUB_OUTPUT | ||
fi | ||
env: | ||
GITHUB_TOKEN: ${{ inputs.token }} | ||
shell: bash | ||
working-directory: ${{ inputs.working-directory }} |