chore(deps): update dependency squizlabs/php_codesniffer to v3.11.1 (… #153
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: Diff check | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
jobs: | |
tests: | |
name: Diff check and push | |
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@v4 | |
id: setup_node_id | |
with: | |
node-version: 18 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.2 | |
# Install openapi-generator-cli | |
- run: echo "OPENAPI_GENERATOR_VERSION=6.6.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: Update document | |
run: | | |
wget https://github.com/phpDocumentor/phpDocumentor/releases/download/v3.3.1/phpDocumentor.phar | |
php phpDocumentor.phar run -d src -t docs | |
- run: | | |
diff=$(git --no-pager diff --name-only HEAD) | |
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 [email protected] | |
git checkout -b update-diff-${{ env.CURRENT_DATETIME }} | |
git add line-openapi | |
git add src/** | |
git commit --allow-empty -m "Codes are generated by openapi generator" | |
git add docs/** | |
git commit --allow-empty -m "Update document" | |
git push origin update-diff-${{ env.CURRENT_DATETIME }} | |
gh pr create -B ${{ github.ref_name }} -t "Codes are generated by openapi generator" -b "" --label "line-openapi-update" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |