Skip to content

Generate SDK on PR

Generate SDK on PR #12

Workflow file for this run

name: Build SDK
on:
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
# - name: Set up Node.js
# uses: actions/setup-node@v2
# with:
# node-version: 14
- name: Merge the OpenAPI Specs
run: |
chmod +x merge.sh # Make the script executable
./merge.sh
continue-on-error: false # Stop the workflow if merge.sh returns a non-zero exit code
- name: Build SDK from OpenApi Spec
run: |
chmod +x build-sdk.sh # Make the script executable
./build-sdk.sh
continue-on-error: false # Stop the workflow if build-sdk.sh returns a non-zero exit code
- name: Swith to publish .gitignore
run: |
cp .gitignore .gitignore.local
cp .gitignore.pub .gitignore
echo "${{ github.event.pull_request.user }}"
continue-on-error: false
- name: Commit SDK updates
uses: EndBug/add-and-commit@v9
with:
# The arguments for the `git add` command (see the paragraph below for more info)
# Default: '.'
add: 'open-api-spec.yml guard-rails-api-client'
# The name of the user that will be displayed as the author of the commit.
# Default: depends on the default_author input
author_name: ${{ github.event.pull_request.user.name }}
# The email of the user that will be displayed as the author of the commit.
# Default: depends on the default_author input
author_email: ${{ github.event.pull_request.user.email }}
# The message for the commit.
# Default: 'Commit from GitHub Actions (name of the workflow)'
message: 'update generated sdk'
# The way the action should handle pathspec errors from the add and remove commands. Three options are available:
# - ignore -> errors will be logged but the step won't fail
# - exitImmediately -> the action will stop right away, and the step will fail
# - exitAtEnd -> the action will go on, every pathspec error will be logged at the end, the step will fail.
# Default: ignore
pathspec_error_handling: exitAtEnd
# Whether to push the commit and, if any, its tags to the repo. It can also be used to set the git push arguments (see the paragraph below for more info)
# Default: true
push: true