Currently, the configuration for openapi-generator for line-bot-sdk-php is written in three workflows, which is a source of errors. Additionally, in the repository managing the OpenAPI schema, it's easy to forget to synchronize the settings.
One solution is to provide just one configuration file or script in this repository and have the CIs simply use it.
-
|
# Install openapi-generator-cli |
|
- run: echo "OPENAPI_GENERATOR_VERSION=7.10.0" >> $GITHUB_ENV |
|
- uses: actions/cache@v4 |
|
id: openapi-generator-cache |
|
env: |
|
cache-name: openapi-generator-cache |
|
with: |
|
path: ~/bin/openapitools |
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.OPENAPI_GENERATOR_VERSION }} |
|
- if: steps.openapi-generator-cache.outputs.cache-hit != 'true' |
|
run: | |
|
mkdir -p ~/bin/openapitools |
|
curl https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/bin/utils/openapi-generator-cli.sh > ~/bin/openapitools/openapi-generator-cli |
|
chmod u+x ~/bin/openapitools/openapi-generator-cli |
|
export PATH=$PATH:~/bin/openapitools/ |
|
OPENAPI_GENERATOR_VERSION=${{ env.OPENAPI_GENERATOR_VERSION }} openapi-generator-cli version |
|
|
|
- name: Generate codes |
|
run: | |
|
export PATH=$PATH:~/bin/openapitools/ |
|
bash tools/gen-oas-client.sh |
-
|
- name: Install openapi-generator-cli |
|
run: echo "OPENAPI_GENERATOR_VERSION=7.10.0" >> $GITHUB_ENV |
|
- uses: actions/cache@v4 |
|
id: openapi-generator-cache |
|
env: |
|
cache-name: openapi-generator-cache |
|
with: |
|
path: ~/bin/openapitools |
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.OPENAPI_GENERATOR_VERSION }} |
|
- if: steps.openapi-generator-cache.outputs.cache-hit != 'true' |
|
run: | |
|
mkdir -p ~/bin/openapitools |
|
curl https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/bin/utils/openapi-generator-cli.sh > ~/bin/openapitools/openapi-generator-cli |
|
chmod u+x ~/bin/openapitools/openapi-generator-cli |
|
export PATH=$PATH:~/bin/openapitools/ |
|
OPENAPI_GENERATOR_VERSION=${{ env.OPENAPI_GENERATOR_VERSION }} openapi-generator-cli version |
|
|
|
- name: Generate code |
|
run: | |
|
export PATH=$PATH:~/bin/openapitools/ |
|
bash tools/gen-oas-client.sh |
-
https://github.com/line/line-openapi/blob/0af4f53f23960ae0019526f631cf0fe81528e03f/.github/workflows/sdk-testing.yml#L133-L153
Currently, the configuration for openapi-generator for line-bot-sdk-php is written in three workflows, which is a source of errors. Additionally, in the repository managing the OpenAPI schema, it's easy to forget to synchronize the settings.
One solution is to provide just one configuration file or script in this repository and have the CIs simply use it.
line-bot-sdk-php/.github/workflows/generate-code.yml
Lines 31 to 51 in d012e5c
line-bot-sdk-php/.github/workflows/php-checks.yml
Lines 34 to 54 in d012e5c
https://github.com/line/line-openapi/blob/0af4f53f23960ae0019526f631cf0fe81528e03f/.github/workflows/sdk-testing.yml#L133-L153