Skip to content

Commit

Permalink
Fix shellcheck issues in doc-tests.yaml script
Browse files Browse the repository at this point in the history
- Add `exit` commands for failed `cd`s
- Don't read from and write to `package.json` in the same pipeline
- Add double quotes around variables
  • Loading branch information
ptgott committed Dec 16, 2024
1 parent 5d41dad commit d999eea
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/doc-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,15 @@ jobs:
run: |
echo "" > .gitmodules
rm -rf content/*
cd content
cd content || exit 1
# Rather than using a submodule, copy the teleport source into the
# content directory.
cp -r $GITHUB_WORKSPACE/teleport $GITHUB_WORKSPACE/docs/content/current
cd $GITHUB_WORKSPACE/docs
jq -nr --arg version $BRANCH '{"versions": [{"name": $version,"branch": $version, "deprecated": false, "latest": true, "current": true }]}' > config.json
cat <<< "$(jq '.scripts."git-update" = "echo Skipping submodule update"' package.json)" > package.json
cat <<< "$(jq '.scripts."prepare-sanity-data" = "echo Using pre-populated Sanity data"' package.json)" > package.json
cp -r "$GITHUB_WORKSPACE/teleport" "$GITHUB_WORKSPACE/docs/content/current"
cd "$GITHUB_WORKSPACE/docs" || exit 1
jq -nr --arg version "$BRANCH" '{"versions": [{"name": $version,"branch": $version, "deprecated": false, "latest": true, "current": true }]}' > config.json
NEW_PACKAGE_JSON=$(jq '.scripts."git-update" = "echo Skipping submodule update"' package.json);
NEW_PACKAGE_JSON=$(jq '.scripts."prepare-sanity-data" = "echo Using pre-populated Sanity data"' <<< "$NEW_PACKAGE_JSON");
echo "$NEW_PACKAGE_JSON" > package.json;
echo "{}" > data/events.json
echo '{"bannerButtons":{"second":{"title":"LOG IN","url":"https://teleport.sh"},"first":{"title":"Support","url":"https://goteleport.com/support/"}},"navbarData":{"rightSide":{},"logo":"/favicon.svg","menu":[]}}' > data/navbar.json
Expand Down

0 comments on commit d999eea

Please sign in to comment.