Skip to content

Commit 7a7de92

Browse files
authored
ci(docs): Fix build doc error (#2383)
Fix build doc error
2 parents a73ef07 + 5faf628 commit 7a7de92

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

.github/workflows/doc-image-publish.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: Build and push docs image
2-
32
on:
43
push:
54
branches:
@@ -14,15 +13,29 @@ on:
1413
release:
1514
types: [published]
1615
workflow_dispatch:
17-
16+
inputs:
17+
branch:
18+
description: 'Branch to build (default: main)'
19+
required: true
20+
default: 'main'
21+
type: string
1822
permissions:
1923
contents: read
20-
2124
jobs:
2225
build-image:
2326
runs-on: ubuntu-latest
2427
steps:
2528
- uses: actions/checkout@v3
29+
with:
30+
fetch-depth: 0
31+
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.branch || github.ref }}
32+
33+
- name: Debug git status
34+
run: |
35+
echo "Current commit: $(git rev-parse HEAD)"
36+
echo "Current branch: $(git rev-parse --abbrev-ref HEAD || echo 'detached HEAD')"
37+
echo "Main branch commit: $(git rev-parse origin/main)"
38+
echo "Using branch: ${{ github.event_name == 'workflow_dispatch' && inputs.branch || github.ref_name }}"
2639
2740
- name: Set up QEMU
2841
uses: docker/setup-qemu-action@v2
@@ -47,6 +60,7 @@ jobs:
4760
file: ./docs/Dockerfile-deploy
4861
platforms: linux/amd64
4962
push: false
63+
5064
# Only run when it is not a PR, build and push the image
5165
- name: Build and push
5266
if: github.event_name != 'pull_request'
@@ -56,4 +70,4 @@ jobs:
5670
file: ./docs/Dockerfile-deploy
5771
platforms: linux/amd64
5872
push: true
59-
tags: eosphorosai/dbgpt-docs:${{ github.ref_name }},eosphorosai/dbgpt-docs:latest
73+
tags: eosphorosai/dbgpt-docs:${{ github.event_name == 'workflow_dispatch' && inputs.branch || github.ref_name }},eosphorosai/dbgpt-docs:latest

docs/Dockerfile-deploy

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@ COPY . /app
2525

2626
# Make sure we have the latest version of the repository
2727
RUN if [ "$CI" = "true" ]; then \
28-
git fetch --prune --unshallow; \
28+
# Check if the repo is shallow before trying to unshallow it
29+
if git rev-parse --is-shallow-repository | grep -q 'true'; then \
30+
git fetch --prune --unshallow; \
31+
else \
32+
echo "Repository is already complete, skipping unshallow"; \
33+
git fetch --prune; \
34+
fi; \
2935
fi
3036

3137
ARG NUM_VERSION=2

0 commit comments

Comments
 (0)