From 89fec1581ce7c2e10b2dfa6217049ee38758891b Mon Sep 17 00:00:00 2001 From: Ilya Andriyanov Date: Wed, 18 Dec 2024 08:07:56 +0300 Subject: [PATCH] fix: checking if api changed before commiting --- .github/workflows/ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2971eca..999db42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -135,13 +135,21 @@ jobs: - name: Generate API specification run: | swag init --generalInfo ./cmd/app/main.go --output api/ --pd + - name: Check if API updated + uses: tj-actions/verify-changed-files@v20 + id: verify-changed-files + with: + files: | + api - name: Commit API + if: steps.verify-changed-files.outputs.files_changed == 'true' run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" git add ./api git commit -m "chore: update api" - name: Push API + if: steps.verify-changed-files.outputs.files_changed == 'true' uses: ad-m/github-push-action@master with: github_token: ${{ github.token }}