automatic update #42
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: automatic update | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
jobs: | |
skip: | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "[Skip CI] ${{ contains(github.event.head_commit.message, '[skip ci]') }}" | |
release: | |
name: release | |
runs-on: ubuntu-latest | |
if: contains(github.event.head_commit.message, '[skip ci]') == false | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version-file: ./go.mod | |
- name: Generate files by openapi-generator | |
run: sh ./generate.sh | |
- name: Check diff | |
run: | | |
git add . | |
DIFFS=`git diff --name-only HEAD` | |
echo $DIFFS | |
if [ "$DIFFS" = '' ]; then | |
echo "HAS_DIFF=false" >> $GITHUB_ENV | |
else | |
echo "HAS_DIFF=true" >> $GITHUB_ENV | |
fi | |
git reset HEAD | |
- name: git commit and push | |
if: env.HAS_DIFF == 'true' | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
git add . | |
git commit -m "CI: regenerate [ci skip]" --author . | |
git push origin master |