Merge pull request #471 from tokuhirom/openapi-prototype #1
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
name: Generate OpenAPI based code | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
jobs: | |
tests: | |
name: Generate OpenAPI based code | |
runs-on: ubuntu-latest | |
steps: | |
# Setup | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Update submodules | |
run: git submodule update --remote --recursive | |
- uses: actions/setup-node@v3 | |
id: setup_node_id | |
with: | |
node-version: 18 | |
- name: actions/setup-java@v3 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
architecture: x64 | |
# Generate codes | |
- run: | | |
python3 generate-code.py | |
# Run tests | |
- run: npm run test | |
- run: | | |
diff=$(git --no-pager diff --name-only) | |
echo "DIFF_IS_EMPTY=$([[ -z "$diff" ]] && echo 'true' || echo 'false')" >> $GITHUB_ENV | |
echo "CURRENT_DATETIME=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV | |
- if: ${{ env.DIFF_IS_EMPTY != 'true' }} | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git checkout -b update-diff-${{ env.CURRENT_DATETIME }} | |
git add lib/** | |
git commit --allow-empty -m "Codes are generated by openapi" | |
git push origin update-diff-${{ env.CURRENT_DATETIME }} | |
gh pr create -B ${{ github.ref_name }} -t "Codes are generated by openapi" -b "" --label "line-openapi-update" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |