Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Smoke tests: fix for repo forks, but also disable on push #1827

Merged
merged 1 commit into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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