diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index fe4bbdf3..1d814660 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -28,4 +28,4 @@ jobs: uses: actions/checkout@v4 - name: Test example in the README.md - run: bash <(sed -n -e '/^ *#!/,/^```$/p' README.md | grep -v '```') + run: scripts/run-README-example diff --git a/scripts/run-README-example b/scripts/run-README-example new file mode 100755 index 00000000..32528cca --- /dev/null +++ b/scripts/run-README-example @@ -0,0 +1,9 @@ +#!/bin/bash +# +# A helper to assist with running the example embedded in README.md +# +set -eu -o pipefail + +cd "$(dirname "$0")/.." + +bash <(sed -n -e '/^ *#!/,/^```$/p' README.md | grep -v '```')