Skip to content

Commit

Permalink
ci: check for empty changes before trying to commit (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewwylde authored Jan 31, 2024
1 parent 2a8933d commit 4a967cd
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/generate-sdk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
runs-on: ubuntu-latest
needs: [get-changed-files]
if: needs.get-changed-files.outputs.oas-modified == 'true'
env:
changes_exist: false
steps:

- uses: actions/checkout@v4
Expand All @@ -42,7 +44,19 @@ jobs:
sdk_output_directory: ${{ github.workspace }}/actions
token: ${{ secrets.GITHUB_TOKEN }}

- name: Check if SDK output has changed
shell: bash
working-directory: ${{ github.workspace }}/actions
run: |
gh pr checkout ${{ github.event.pull_request.number }}
if git diff src --exit-code; then
echo "::set-env name=changes_exist::false"
else
echo "::set-env name=changes_exist::true"
fi
- name: Commit SDK changes to the PR
if: ${{ env.changes_exist == 'true' }}
shell: bash
working-directory: ${{ github.workspace }}/actions
env:
Expand Down

0 comments on commit 4a967cd

Please sign in to comment.