From 7252bc3361973fcf2ecda3c24bfc9051a4df6b71 Mon Sep 17 00:00:00 2001 From: Austin Vazquez Date: Sat, 1 Jun 2024 23:47:46 +0000 Subject: [PATCH] Fix bug in update getting started guide workflow This change fixes a bug in the update getting started guide workflow when assertions are disabled. This change also fixes a bug where '--verbose' executed git diff command in interactive mode. Signed-off-by: Austin Vazquez --- .github/workflows/update-getting-started-guide.yml | 8 +------- scripts/update-getting-started-guide-version.sh | 10 ++++++++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/update-getting-started-guide.yml b/.github/workflows/update-getting-started-guide.yml index 5f896a681..e650ed4f9 100644 --- a/.github/workflows/update-getting-started-guide.yml +++ b/.github/workflows/update-getting-started-guide.yml @@ -23,9 +23,6 @@ jobs: contents: read pull-requests: read - env: - RELEASE_TAG: '' - steps: - uses: actions/checkout@v4 with: @@ -33,11 +30,8 @@ jobs: docs/getting-started.md scripts/update-getting-started-guide-version.sh - - name: Mock release tag on pull request - run: echo "RELEASE_TAG=v0.0.0-${{ github.event.pull_request.number }}" >> $GITHUB_ENV - - name: Test update getting started version - run: bash scripts/update-getting-started-guide-version.sh --assert ${{ env.RELEASE_TAG }} + run: bash scripts/update-getting-started-guide-version.sh --assert v0.0.0-${{ github.event.pull_request.number }} update-version: if: github.event_name == 'release' diff --git a/scripts/update-getting-started-guide-version.sh b/scripts/update-getting-started-guide-version.sh index 00147a333..2da8f1208 100755 --- a/scripts/update-getting-started-guide-version.sh +++ b/scripts/update-getting-started-guide-version.sh @@ -69,5 +69,11 @@ assert_diff() { sed -i -E "s/version=\"([0-9]+\.){2}[0-9]+\"/version=\"${VERSION}\"/" docs/getting-started.md -[ $VERBOSE = true ] && git diff -[ $ASSERT = true ] && assert_diff +if [ $VERBOSE = true ]; then + git --no-pager diff +fi + +if [ $ASSERT = true ]; then + assert_diff +fi +