Skip to content

Commit 55c0475

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

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
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: 9 additions & 6 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,14 @@ 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+
git rm -r '*'
39+
cp -R "$DOCS_HOME"/docs/* .
3640
git add .
37-
git commit -m "docs: prepare workshop docs"
41+
git commit --amend -m "docs: prepare workshop docs"
3842
git push -u origin docs --force
39-
4043
rm -rf "$DOCS_HOME"
4144
fi
4245

0 commit comments

Comments
 (0)