Skip to content

Commit ccdaa42

Browse files
committed
build-docs.yml: update build workflow to use GITHUB_TOKEN for repository authentication
enable manual triggering for documentation build workflow Signed-off-by: ravindu644 <droidcasts@protonmail.com>
1 parent b3955fc commit ccdaa42

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

.github/workflows/build-docs.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,23 @@ name: Build Docs
33
on:
44
repository_dispatch:
55
types: [docs-updated]
6+
workflow_dispatch:
67

78
jobs:
89
build:
910
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
1013
steps:
1114
- uses: actions/checkout@v4
1215

1316
- name: Fetch latest docs from source repo
14-
env:
15-
PAT: ${{ secrets.SOURCE_REPO_PAT }}
1617
run: |
17-
REPO="https://github.com/YOUR_USERNAME/YOUR_SOURCE_REPO.git"
18-
if [ -n "$PAT" ]; then
19-
REPO="https://x-access-token:${PAT}@github.com/YOUR_USERNAME/YOUR_SOURCE_REPO.git"
20-
fi
21-
git clone --depth 1 --branch main "$REPO" /tmp/source
18+
git clone --depth 1 --branch main \
19+
https://github.com/ravindu644/Droidspaces-OSS.git /tmp/source
2220
rm -rf docs/content/
23-
cp -r /tmp/source/docs/content docs/content/
21+
mkdir -p docs/content
22+
cp -r /tmp/source/Documentation/. docs/content/
2423
2524
- name: Build HTML
2625
run: python3 .github/scripts/build-docs.py
@@ -31,8 +30,13 @@ jobs:
3130
- name: Commit and push
3231
run: |
3332
SHA="${{ github.event.client_payload.sha }}"
33+
if [ -z "$SHA" ]; then
34+
SHA=$(git -C /tmp/source rev-parse HEAD)
35+
fi
3436
git config user.name "docs-bot"
3537
git config user.email "bot@droidspaces.org"
38+
git remote set-url origin \
39+
https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git
3640
git add -A
3741
git diff --cached --quiet || \
3842
git commit -m "docs: update from source@${SHA:0:7}" && \

0 commit comments

Comments
 (0)