Skip to content

Commit

Permalink
[CI] Smoke tests: fix for repo forks, but also disable on push (#1827)
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin committed Feb 3, 2024
1 parent 8a32b91 commit 82622a2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/smoke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 13 additions & 4 deletions tools/make-site.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 82622a2

Please sign in to comment.