diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index e394f32..d21d49e 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -43,11 +43,22 @@ jobs: jq ".version = \"${{ steps.get_version.outputs.version }}\"" package.json > tmp.json mv tmp.json package.json - - name: Commit version change + - name: Check if there are changes to commit + id: check_changes + run: | + git add package.json + if git diff-index --quiet HEAD --; then + echo "No changes to commit." + echo "::set-output name=changes::false" + else + echo "::set-output name=changes::true" + fi + + - name: Commit version change to main + if: steps.check_changes.outputs.changes == 'true' run: | git config --local user.name "GitHub Actions" git config --local user.email "actions@github.com" - git add package.json git commit -m "Update version to ${{ steps.get_version.outputs.version }}" git push origin HEAD:main