diff --git a/.github/workflows/smoke.yaml b/.github/workflows/smoke.yaml index cb27552aa8..d5e5e64363 100644 --- a/.github/workflows/smoke.yaml +++ b/.github/workflows/smoke.yaml @@ -25,6 +25,7 @@ jobs: SHA: ${{ github.sha }} # TODO: drop PR testing under Windows because it's too slow? # if: github.event_name != 'pull_request' && matrix.os != 'windows-latest' + if: github.event_name != 'push' || github.repository == 'google/docsy' steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 diff --git a/tools/make-site.sh b/tools/make-site.sh index 29c0415999..67c9435d27 100755 --- a/tools/make-site.sh +++ b/tools/make-site.sh @@ -142,13 +142,22 @@ function _set_up_site_using_hugo_modules() { else echo "[INFO] Fetch Docsy GitHub repo '$DOCSY_REPO' @ '$DOCSY_VERS'" mkdir tmp - BRANCH_SPEC="" + local BRANCH_SPEC="" + local DEPTH=10 + local SWITCH_NEEDED= + local CLONE="git clone --depth=$DEPTH https://github.com/$DOCSY_REPO tmp/docsy" if [[ -n $DOCSY_VERS ]]; then BRANCH_SPEC="-b $DOCSY_VERS" fi - git clone --depth=1 https://github.com/$DOCSY_REPO $BRANCH_SPEC tmp/docsy - (cd tmp/docsy && git log -1) - + if ! $CLONE $BRANCH_SPEC; then + SWITCH_NEEDED=1 + $CLONE + fi + ( \ + cd tmp/docsy && \ + git log --oneline -$DEPTH && \ + if [[ -n $SWITCH_NEEDED ]]; then git switch --detach $DOCSY_VERS; fi \ + ) echo "replace github.com/$DOCSY_REPO_DEFAULT => ./tmp/docsy" >> go.mod eval "$HUGO mod get github.com/$DOCSY_REPO_DEFAULT" $OUTPUT_REDIRECT fi