Skip to content

Commit

Permalink
Fix bug in update getting started guide workflow
Browse files Browse the repository at this point in the history
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 <macedonv@amazon.com>
  • Loading branch information
austinvazquez committed Jun 2, 2024
1 parent 310a88e commit 7252bc3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/update-getting-started-guide.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,15 @@ jobs:
contents: read
pull-requests: read

env:
RELEASE_TAG: ''

steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
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'
Expand Down
10 changes: 8 additions & 2 deletions scripts/update-getting-started-guide-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7252bc3

Please sign in to comment.