Skip to content

Commit b935dfe

Browse files
committed
ci: fix docs workflow
1 parent 7218d67 commit b935dfe

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

.github/workflows/docs.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ on:
33
push:
44
branches: [main]
55

6+
permissions:
7+
contents: write
8+
69
jobs:
710
build:
811
name: Build docs
@@ -21,5 +24,3 @@ jobs:
2124
git config --global user.name "sinedied"
2225
git config --global user.email "[email protected]"
2326
./scripts/repo/build-docs.sh
24-
env:
25-
GH_TOKEN: ${{ secrets.GH_TOKEN }}

scripts/repo/build-docs.sh

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ cd "$(dirname "${BASH_SOURCE[0]}")/../.."
99

1010
DOCS_HOME=/tmp/azure-openai-rag-workshop-docs
1111
GH_USER=$(git config user.name)
12-
REPO=https://$GH_USER:$GH_TOKEN@github.com/Azure-Samples/azure-openai-rag-workshop.git
12+
REPO=$(git remote get-url origin)
13+
BASE=$(pwd)
1314

15+
echo "Target repository: $REPO"
1416
echo "Preparing all workshop docs..."
1517
echo "(temp folder: $DOCS_HOME)"
1618
rm -rf "$DOCS_HOME"
@@ -30,13 +32,23 @@ if [[ ${1-} == "--local" ]]; then
3032
open "$DOCS_HOME"
3133
else
3234
# Update git repo
33-
git init
34-
git checkout -b docs
35-
git remote add origin "$REPO"
35+
cd "$BASE"
36+
git fetch --depth=1
37+
git checkout docs
38+
echo "Switched to branch: $(git branch --show-current)"
39+
git rm -r '*'
40+
cp -R "$DOCS_HOME"/* .
3641
git add .
37-
git commit -m "docs: prepare workshop docs"
42+
git commit --amend -m "docs: prepare workshop docs"
3843
git push -u origin docs --force
3944

45+
# git init
46+
# git checkout -b docs
47+
# git remote add origin "$REPO"
48+
# git add .
49+
# git commit -m "docs: prepare workshop docs"
50+
# git push -u origin docs --force
51+
4052
rm -rf "$DOCS_HOME"
4153
fi
4254

0 commit comments

Comments
 (0)