diff --git a/.github/workflows/Publish_NIMS.yml b/.github/workflows/Publish_NIMS.yml index b7764154f..4e724d6a5 100644 --- a/.github/workflows/Publish_NIMS.yml +++ b/.github/workflows/Publish_NIMS.yml @@ -54,15 +54,20 @@ jobs: working-directory: ./ni_measurementlink_generator - name: Commit file changes + id: commit if: ${{ startsWith(github.event.release.target_commitish, 'main') || startsWith(github.event.release.target_commitish, 'releases/') }} run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git add . - git commit -m "Promote NIMS package version and update Sphinx generated files in _docs" -a + echo "version_changed=false" >> $GITHUB_OUTPUT + if [ -n "$(git status --porcelain)" ]; then + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add . + git commit -m "Promote NIMS and NIMG package version" -a + echo "version_changed=true" >> $GITHUB_OUTPUT + fi - name: Push changes to the appropriate branch - if: ${{ startsWith(github.event.release.target_commitish, 'main') || startsWith(github.event.release.target_commitish, 'releases/') }} + if: ${{ steps.commit.outputs.version_changed && (startsWith(github.event.release.target_commitish, 'main') || startsWith(github.event.release.target_commitish, 'releases/')) }} uses: CasperWA/push-protected@v2 with: token: ${{ secrets.ADMIN_PAT }}