Skip to content

Commit b7a5aef

Browse files
committed
Enhance GitHub Actions workflow by adding permissions and token validation step for improved documentation sync reliability
1 parent 9f667b7 commit b7a5aef

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

.github/workflows/sync-docs.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ on:
1515
default: false
1616
type: boolean
1717

18+
permissions:
19+
contents: read
20+
actions: read
21+
1822
jobs:
1923
sync-docs:
2024
runs-on: ubuntu-latest
@@ -32,6 +36,21 @@ jobs:
3236
git config --global user.name "docs-sync-bot"
3337
git config --global user.email "bot@altus4.dev"
3438
39+
- name: Validate token access
40+
env:
41+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
42+
run: |
43+
if [ -z "$GH_TOKEN" ]; then
44+
echo "❌ GH_TOKEN is not set or is empty"
45+
exit 1
46+
else
47+
echo "✅ GH_TOKEN is set"
48+
# Test token by making a simple API call
49+
curl -s -H "Authorization: token $GH_TOKEN" \
50+
-H "Accept: application/vnd.github.v3+json" \
51+
https://api.github.com/user | jq -r '.login // "Token validation failed"'
52+
fi
53+
3554
- name: Check for docs changes
3655
id: check_changes
3756
run: |
@@ -63,7 +82,7 @@ jobs:
6382
- name: Sync to docs repository
6483
if: steps.check_changes.outputs.has_changes == 'true'
6584
env:
66-
DOCS_REPO_TOKEN: ${{ secrets.DOCS_SYNC_TOKEN }}
85+
DOCS_REPO_TOKEN: ${{ secrets.GH_TOKEN }}
6786
run: |
6887
# Configuration
6988
DOCS_REPO_URL="https://x-access-token:${DOCS_REPO_TOKEN}@github.com/altus4/docs.git"

0 commit comments

Comments
 (0)